asciichem (Python)
Python implementation of AsciiChem — parse
ASCII chemistry into a semantic model (atoms, bonds, isotopes,
charges, reactions, electron configurations), then render canonical
text or the canonical wire JSON. The defining fix over AsciiMath:
^14C binds the isotope to the atom, never to a phantom {} carrier.
Strategy A of the ecosystem's language-binding
ADR:
a native implementation conforming to the shared contracts —
asciichem-model (v1 wire form) and asciichem-tests (the corpus
every implementation passes). The Ruby gem is the reference; this
package, like the TypeScript one, must agree with it on every corpus
case. Zero runtime dependencies.
Usage
from asciichem import parse_text
from asciichem.text import render
from asciichem.wire import to_model_json, from_model_json
from asciichem.smiles import parse_smiles, write_smiles
formula = parse_text("2H_2 + O_2 ->[heat] 2H_2O")
aspirin = parse_smiles("CC(=O)OC1=CC=CC=C1C(=O)O") # same model, same renderers
write_smiles(aspirin) # deterministic writer; round-trips exactly
render(formula) # canonical AsciiChem text (round-trip contract)
to_model_json(formula) # asciichem-model v1 wire JSON
back = from_model_json(to_model_json(formula))
Conformance claim
Verified in CI against the asciichem-tests corpus and asciichem-model schemas (both cloned as siblings):
| Level | Claim |
|---|---|
| parse/reject | 100% — every corpus case parses or raises ParseError exactly as marked |
| L0 | 100% — emission validates against the v1 JSON Schemas |
| L1 | 100% — render(parse(s)) == s for every roundTrip case |
| SMILES | 100% — ingestion + deterministic emission, every structure/smiles/* fixture (asciichem-tests v0.3.0) |
| molfile | 100% — V2000 ingestion + emission, every structure/molfile/* fixture |
| MathML / resolver | not yet claimed (tracked follow-ups; the Ruby and TS implementations have them) |
Development
pip install -e ".[dev]"
python -m pytest # unit + corpus conformance (siblings cloned)
License
BSD-2-Clause — same as the rest of the AsciiChem ecosystem.
Metadata
Release files for asciichem 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| asciichem-0.1.0.tar.gz | 28.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asciichem-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.8 kB
Release files / asciichem-0.1.0.tar.gz
| Download URL | asciichem-0.1.0.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c94dafea4926e925187c8c76b4d9318791570fa523860cd06d8ba19c2e788b1b
|
|
BLAKE2b-256 checksum How to use checksums |
e1ad87293969074054c28f46a085f7aed51152ff58cbfadc93105069a601e3b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency logRelease files / asciichem-0.1.0-py3-none-any.whl
| Download URL | asciichem-0.1.0-py3-none-any.whl |
|---|---|
| Size | 28.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe992667a77a2538d5ed77aebe01236c039b77a33dfec70a21d4d4488df08ed7
|
|
BLAKE2b-256 checksum How to use checksums |
f2127e0792ea7010bf0d4d892f1d1cd2b278ca2bcec66771cdfc78c15efc0566
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency logSecurity for asciichem 0.1.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 2 files in this release have been uploaded with provenance metadata.
Attestation for asciichem-0.1.0.tar.gz
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 Sep 15, 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.