pubchem-property-fetcher
A CLI tool and Python API to resolve chemical SMILES strings and batch-fetch properties using the PubChem PUG REST API.
It handles SMILES canonicalization via RDKit, groups properties to minimize API calls, respects PubChem's rate limits,
and uses exponential backoff to handle server-side throttling (429, 503). Results are exported as CSV using Polars.
Installation
Ensure you have Python 3.10+ installed. Install the package including its dependencies:
pip install pubchem-property-fetcher
Usage
CLI
Run the script directly from the command line. Pass in SMILES strings, specify the properties, and set an output file. If no output is provided, it prints the CSV to standard output.
# Fetch MolecularWeight and IUPACName
python -m pubchem_property_fetcher "OCC.CC" "CCO" "CCC" \
--properties MolecularWeight --properties IUPACName \
--output results.csv
Special Properties:
--properties synonyms: Fetches common aliases for the structures. Limit the amount returned with--max-synonyms N.--properties label: A custom pipeline property that heuristically picks the most human-readable name from the synonym list, falling back to the formal IUPAC name if no good synonyms exist.
For standard properties like MolecularWeight, XLogP, ExactMass, or TPSA, see the PubChem PUG REST Docs.
Python API
import asyncio
from typing import Any
from pubchem_property_fetcher import (
PubChemClient,
clean_smiles,
fetch_cid_bulk,
fetch_properties_bulk,
)
# fetch properties
async def main() -> dict[int, dict[str, Any]]:
# standardize SMILES
smiles = clean_smiles(["CCO", "CCC"])
async with PubChemClient() as client:
# get PubChem Compound IDs (CIDs)
cids_map = await fetch_cid_bulk(smiles, client)
cids = list(cids_map.values())
return await fetch_properties_bulk(cids, ["IUPACName", "MolecularWeight"], client)
print(asyncio.run(main()))
# {702: {'IUPACName': 'ethanol', 'MolecularWeight': 46.07}, ...}
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pubchem_property_fetcher-0.1.2.tar.gz.
File metadata
- Download URL: pubchem_property_fetcher-0.1.2.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7851a2c89200f0e0e1eee6f94efee9f06043976ff0efc6fa379d688efad5b386
|
|
| MD5 |
11bfb83eb7b9883a28a7c98595406d01
|
|
| BLAKE2b-256 |
5ce1173f81f91b89df852475c8cd9edf271cf68bca02eeebd52476014d5ddcf4
|
Provenance
The following attestation bundles were made for pubchem_property_fetcher-0.1.2.tar.gz:
Publisher:
release.yml on audivir/pubchem-property-fetcher
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pubchem_property_fetcher-0.1.2.tar.gz -
Subject digest:
7851a2c89200f0e0e1eee6f94efee9f06043976ff0efc6fa379d688efad5b386 - Sigstore transparency entry: 2575716929
- Sigstore integration time:
-
Permalink:
audivir/pubchem-property-fetcher@a46670193eeda1386f092828ae2b7bc370353d89 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/audivir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a46670193eeda1386f092828ae2b7bc370353d89 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pubchem_property_fetcher-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pubchem_property_fetcher-0.1.2-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0d3efdb56a871ee8eba3507545faf0eae3028494cd997dc70cde1c38e09f7f2
|
|
| MD5 |
454a004be5f612f31939eb6ece1b9e86
|
|
| BLAKE2b-256 |
9f1cf24772a25d810f360604c3fcf22744a7f2acd08891b3234b55cbab8c86af
|
Provenance
The following attestation bundles were made for pubchem_property_fetcher-0.1.2-py3-none-any.whl:
Publisher:
release.yml on audivir/pubchem-property-fetcher
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pubchem_property_fetcher-0.1.2-py3-none-any.whl -
Subject digest:
a0d3efdb56a871ee8eba3507545faf0eae3028494cd997dc70cde1c38e09f7f2 - Sigstore transparency entry: 2575716940
- Sigstore integration time:
-
Permalink:
audivir/pubchem-property-fetcher@a46670193eeda1386f092828ae2b7bc370353d89 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/audivir
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a46670193eeda1386f092828ae2b7bc370353d89 -
Trigger Event:
release
-
Statement type: