# PubChemPy
[](https://pypi.python.org/pypi/PubChemPy)
[](https://anaconda.org/conda-forge/pubchempy)
[](https://github.com/mcs07/PubChemPy/blob/main/LICENSE)
[](https://zenodo.org/badge/latestdoi/7462957)
[](https://github.com/mcs07/PubChemPy/actions/workflows/test.yml)
[](https://docs.pubchempy.org)
PubChemPy provides a way to interact with PubChem in Python. It allows chemical searches by name, substructure and similarity, chemical standardization, conversion between chemical file formats, depiction and retrieval of chemical properties.
## Installation
Install PubChemPy with pip:
```shell
pip install pubchempy
```
Or with conda:
```shell
conda install -c conda-forge pubchempy
```
For detailed instructions, see the [installation guide](https://docs.pubchempy.org/en/latest/guide/install.html).
## Example usage
Retrieve a compound by its PubChem Compound Identifier (CID) and print its SMILES and IUPAC name:
```pycon
>>> import pubchempy as pcp
>>> comp = pcp.Compound.from_cid(1423)
>>> print(comp.smiles)
CCCCCCCNC1CCCC1CCCCCCC(=O)O
>>> print(comp.iupac_name)
7-[2-(heptylamino)cyclopentyl]heptanoic acid
```
Search compounds by name and print the SMILES and molecular weight of the first result:
```pycon
>>> results = pcp.get_compounds("Aspirin", "name")
>>> print(results[0].smiles)
CC(=O)OC1=CC=CC=C1C(=O)O
>>> print(results[0].molecular_weight)
180.16
```
## Documentation
Full documentation is available at <https://docs.pubchempy.org>.
This includes a [step-by-step guide on how to use PubChemPy](https://docs.pubchempy.org/en/latest/guide/gettingstarted.html), as well as a [complete API reference](https://docs.pubchempy.org/en/latest/api.html).
## Contributing
- Feature ideas and bug reports are welcome on the [Issue Tracker](https://github.com/mcs07/PubChemPy/issues).
- Fork the [source code](https://github.com/mcs07/PubChemPy) on GitHub, make changes and file a pull request.
## License
PubChemPy is licensed under the [MIT license](https://github.com/mcs07/PubChemPy/blob/main/LICENSE).
Raw data
{
"_id": null,
"home_page": null,
"name": "PubChemPy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "pubchem, python, rest, api, chemistry, cheminformatics",
"author": null,
"author_email": "Matt Swain <m.swain@me.com>",
"download_url": "https://files.pythonhosted.org/packages/30/a1/1b63d717a315b5fdc281e312bd02e9069e22ed8aa63a56d79f8dae95a1f2/pubchempy-1.0.5.tar.gz",
"platform": null,
"description": "# PubChemPy\n\n[](https://pypi.python.org/pypi/PubChemPy)\n[](https://anaconda.org/conda-forge/pubchempy)\n[](https://github.com/mcs07/PubChemPy/blob/main/LICENSE)\n[](https://zenodo.org/badge/latestdoi/7462957)\n[](https://github.com/mcs07/PubChemPy/actions/workflows/test.yml)\n[](https://docs.pubchempy.org)\n\nPubChemPy provides a way to interact with PubChem in Python. It allows chemical searches by name, substructure and similarity, chemical standardization, conversion between chemical file formats, depiction and retrieval of chemical properties.\n\n## Installation\n\nInstall PubChemPy with pip:\n\n```shell\npip install pubchempy\n```\n\nOr with conda:\n\n```shell\nconda install -c conda-forge pubchempy\n```\n\nFor detailed instructions, see the [installation guide](https://docs.pubchempy.org/en/latest/guide/install.html).\n\n## Example usage\n\nRetrieve a compound by its PubChem Compound Identifier (CID) and print its SMILES and IUPAC name:\n\n```pycon\n>>> import pubchempy as pcp\n>>> comp = pcp.Compound.from_cid(1423)\n>>> print(comp.smiles)\nCCCCCCCNC1CCCC1CCCCCCC(=O)O\n>>> print(comp.iupac_name)\n7-[2-(heptylamino)cyclopentyl]heptanoic acid\n```\n\nSearch compounds by name and print the SMILES and molecular weight of the first result:\n\n```pycon\n>>> results = pcp.get_compounds(\"Aspirin\", \"name\")\n>>> print(results[0].smiles)\nCC(=O)OC1=CC=CC=C1C(=O)O\n>>> print(results[0].molecular_weight)\n180.16\n```\n\n## Documentation\n\nFull documentation is available at <https://docs.pubchempy.org>.\n\nThis includes a [step-by-step guide on how to use PubChemPy](https://docs.pubchempy.org/en/latest/guide/gettingstarted.html), as well as a [complete API reference](https://docs.pubchempy.org/en/latest/api.html).\n\n## Contributing\n\n- Feature ideas and bug reports are welcome on the [Issue Tracker](https://github.com/mcs07/PubChemPy/issues).\n- Fork the [source code](https://github.com/mcs07/PubChemPy) on GitHub, make changes and file a pull request.\n\n## License\n\nPubChemPy is licensed under the [MIT license](https://github.com/mcs07/PubChemPy/blob/main/LICENSE).\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple Python wrapper around the PubChem PUG REST API.",
"version": "1.0.5",
"project_urls": {
"Documentation": "https://docs.pubchempy.org",
"Homepage": "https://github.com/mcs07/PubChemPy",
"Issue Tracker": "https://github.com/mcs07/PubChemPy/issues",
"Releases": "https://github.com/mcs07/PubChemPy/releases",
"Repository": "https://github.com/mcs07/PubChemPy"
},
"split_keywords": [
"pubchem",
" python",
" rest",
" api",
" chemistry",
" cheminformatics"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6be32c887645f21b94d992a16775bcf81cdf6dcc36cf1606782cb2a3c86e9a35",
"md5": "2ed5571a15adfb0098f85a003d438480",
"sha256": "e936cfed31fa194042ad463be3c803dde5b12ef2f795caf336e3114127c34fa0"
},
"downloads": -1,
"filename": "pubchempy-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ed5571a15adfb0098f85a003d438480",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 21355,
"upload_time": "2025-09-08T20:53:00",
"upload_time_iso_8601": "2025-09-08T20:53:00.831411Z",
"url": "https://files.pythonhosted.org/packages/6b/e3/2c887645f21b94d992a16775bcf81cdf6dcc36cf1606782cb2a3c86e9a35/pubchempy-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "30a11b63d717a315b5fdc281e312bd02e9069e22ed8aa63a56d79f8dae95a1f2",
"md5": "34e4b6b52a1380d1d3fb51260e193b18",
"sha256": "08f0b2a82a5caa5d61e14935d655da554602d7b5686fe661ab584c882ffff623"
},
"downloads": -1,
"filename": "pubchempy-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "34e4b6b52a1380d1d3fb51260e193b18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 26814,
"upload_time": "2025-09-08T20:53:01",
"upload_time_iso_8601": "2025-09-08T20:53:01.971851Z",
"url": "https://files.pythonhosted.org/packages/30/a1/1b63d717a315b5fdc281e312bd02e9069e22ed8aa63a56d79f8dae95a1f2/pubchempy-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 20:53:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mcs07",
"github_project": "PubChemPy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pubchempy"
}