Nazuchem for Python
Python bindings for chemical names, semantic CXSMILES, and the versioned
Nazuchem molecule IR. Python 3.10 or newer is required. The PyO3 extension uses
abi3-py310, with a thin typed Python facade and no runtime Python dependencies.
See the generated NOTICE and root NOTICE for the licence scope and the data
files those licences do not cover.
Install with uv:
uv add nazuchem
import json
import nazuchem
smiles = nazuchem.name_to_smiles("ethanol")
name = nazuchem.smiles_to_name(smiles)
assert name.text == "ethanol"
molecule = nazuchem.name_to_molecule("(2R)-2-hydroxypropanoic acid")
assert molecule["nazuchem_ir"] == nazuchem.IR_VERSION
roundtrip = nazuchem.molecule_to_name(molecule)
from_json = nazuchem.molecule_to_name(json.dumps(molecule))
schema = json.loads(nazuchem.JSON_SCHEMA)
The four functions are name_to_smiles(str) -> str, smiles_to_name(str) -> Name,
name_to_molecule(str) -> dict, and molecule_to_name(dict | str) -> Name.
The IR object includes its version and all supported structure metadata. Rust
validates every IR input against the versioned format and graph invariants;
unknown fields, unsupported versions, and invalid atom/bond/stereo references
fail explicitly. Dict inputs use Python's JSON encoder with allow_nan=False,
so non-finite numbers and values the encoder cannot serialize fail before reaching
Rust. It never changes the input dict.
Name is a frozen dataclass containing text, status, reason, alternatives,
omitted_stereo, omitted_units, and verification. Status and reason strings
retain Rust's snake_case JSON values. NameStatus is the literal union
"preferred" | "not_preferred" | "unverified". alternatives contains frozen
AlternativeName(name, status, reason) objects. verification, when present,
is a frozen Verification(name, smiles) for a recovered neutral radical-ion
target. Collection fields are tuples. No Rust result fields are discarded.
Engine failures raise NazuchemError, a ValueError subclass. Its message
preserves the Rust error, and .kind uses the stable ErrorKind literal union:
"init" | "parse" | "warning" | "serialize" | "naming" | "internal".
IR decode/validation failures use "serialize". Unexpected Rust panics are
caught at the extension boundary and reported as "internal".
Python argument type errors raise TypeError; non-finite numbers and circular
dict/list references raise ValueError.
From this directory, build and test the actual wheel with uv:
uv sync --no-install-project --python 3.12
uv run --no-sync python scripts/build_wheel.py
uv run --no-project --python 3.12 --with ./dist/<wheel>.whl --with pytest --with jsonschema python -m pytest tests
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
uv run --no-sync ty check
uv run --no-sync cargo test -p nazuchem-python --lib --locked
build_wheel.py generates all four legal files using the root collector, builds
with uv and maturin --locked, then unzips the wheel to byte-compare each
PEP 639 .dist-info/licenses/ member against freshly generated files. It fails
on missing, stale, or changed notice bytes. The generated files, virtualenv,
native libraries, and wheels are ignored by Git. The collector runs once into
a fresh temporary directory; missing or empty generation fails before the wheel
is built. Add --release for optimization, or --target <Rust triple> for a
target build; the wrapper forwards that target to the collector and maturin.
Use the wrapper when building distribution wheels so their notices are verified.
For plain Cargo checks, set PYO3_PYTHON to a Python 3.10+ interpreter if the
system default Python is older. These commands build local artifacts only.
Metadata
Release files for nazuchem 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nazuchem-0.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for nazuchem-0.2.0-cp310-abi3-win_amd64.whl |
| nazuchem-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details for nazuchem-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl |
| nazuchem-0.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for nazuchem-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
Total release size: 26.8 MB
Release files / nazuchem-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | nazuchem-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 9.0 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7a7d88d2de448c3b569aa5711528014cc1c4a35e5456142f2c9ba89e4d512611
|
|
BLAKE2b-256 checksum How to use checksums |
9aa8ae815fb548ee9c6484a7b03dfadc0f3d44171ccd4d2d10f6df348dd519d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / nazuchem-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | nazuchem-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 9.0 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
29647b28656b4c713e31a45c79dc70900ceb093d70ee7afda83e1f657ded07f1
|
|
BLAKE2b-256 checksum How to use checksums |
7742ba038033eefa3987800e40fccba7b6e765800f60a7ddbf3d5d35270e4a83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / nazuchem-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | nazuchem-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.8 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9f1021cdda8eaf6ab3872ff197a4ec60202a008d16fd5ee3537295ddfc116f41
|
|
BLAKE2b-256 checksum How to use checksums |
cc62bbe8b00c21e27b6a7480b13877e839eb2114984af47b5ae10155044463c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for nazuchem 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 3 files in this release have been uploaded with provenance metadata.
Attestation for nazuchem-0.2.0-cp310-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.