Rust-first SMILES enumeration and next-token decoding with Python bindings.
Project description
grimace-py
grimace-py is a Rust-first RDKit add-on for exact rooted SMILES support
enumeration, online next-token decoding, seeded sampling, and reusable prepared
molecules. It provides:
- exact support enumeration for Grimace's supported writer language
- exact token inventories implied by that support
- legal next-token choices from a current SMILES prefix
- seeded legal samples with per-step token choices
- prepared molecule bytes for reuse without RDKit at read time
GRIMACE stands for "graph representation integrating multiple alternate chemical equivalents", motivated by research on NMR spectroscopy with language transformers (link).
The public import name is grimace. Install the PyPI distribution named
grimace-py:
python -m pip install grimace-py
import grimace
Plain pip install grimace installs an unrelated older package.
Repository: github.com/numpde/grimace-py.
grimace-py is distributed under PolyForm-Noncommercial-1.0.0. Commercial
use is not permitted under the current license.
Quick example
This example uses the currently supported runtime mode. See Runtime for flags and roots, and Limitations for scope and known gaps.
from rdkit import Chem
import grimace
mol = Chem.MolFromSmiles("CC(=O)Oc1ccccc1C(=O)O")
all_smiles = tuple(
grimace.MolToSmilesEnum(
mol,
rootedAtAtom=-1,
isomericSmiles=False,
canonical=False,
doRandom=True,
)
)
assert len(all_smiles) == 304
What to use
- Enumerate every supported string with
MolToSmilesEnum(...). - Step through legal next tokens with
MolToSmilesDecoder(...)orMolToSmilesDeterminizedDecoder(...). - Draw one seeded legal string with per-step token choices using
MolToSmilesSample(...). - Diagnose rejected candidates with
MolToSmilesDeviation(...). - Build dataset token coverage with
MolToSmilesTokenInventorySuperset(...). - Reuse prepared molecules with
PrepareMol(...)andPreparedMol.
Documentation
Please find the main documentation at numpde.github.io/grimace-py.
Install matrix
Package metadata declares Python >=3.11 and rdkit>=2026.3.
The currently exercised release matrix publishes Linux x86_64 wheels for
CPython 3.12 and 3.13, plus a source distribution. Other Python versions
and non-Linux platforms are expected source-build paths today.
For a host source build, you need Rust >=1.83 and maturin:
python -m venv .venv
. .venv/bin/activate
python -m pip install maturin
maturin develop --release
Development
Routine local checks are Docker-backed:
make checks
make ci
make test-package
make docs
make docs-serve
See containerized development for the lane contract.
License
grimace-py is source-available under
PolyForm Noncommercial 1.0.0. Third-party components remain under
their own licenses; see THIRD_PARTY_NOTICES.md.
Commercial use requires a separate commercial license from the author.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 grimace_py-0.1.16.tar.gz.
File metadata
- Download URL: grimace_py-0.1.16.tar.gz
- Upload date:
- Size: 5.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f33e70b074915045ef7971e4f0be00318bdd8f086b960cbc0f89b4e1eecbd40
|
|
| MD5 |
cd6fe018add97e8f8afa27ba22f825e9
|
|
| BLAKE2b-256 |
0284df1498de3b89f962c25b26749f001c1c6199a1bd0523788031dbef1aaad9
|
Provenance
The following attestation bundles were made for grimace_py-0.1.16.tar.gz:
Publisher:
release.yml on numpde/grimace-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grimace_py-0.1.16.tar.gz -
Subject digest:
8f33e70b074915045ef7971e4f0be00318bdd8f086b960cbc0f89b4e1eecbd40 - Sigstore transparency entry: 1740409471
- Sigstore integration time:
-
Permalink:
numpde/grimace-py@e3ac684853c780e00b519396a8758f19a7adde96 -
Branch / Tag:
refs/tags/v0.1.16 - Owner: https://github.com/numpde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e3ac684853c780e00b519396a8758f19a7adde96 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grimace_py-0.1.16-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: grimace_py-0.1.16-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 772.9 kB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
732528dfddb7eba05895dc464c63999bdf963b7ad5b5132b14c4529591fe0f98
|
|
| MD5 |
f39cbf8c18060c9aba930f1563f4c5dc
|
|
| BLAKE2b-256 |
0f7759ad05f2f338516795e6c93849b917fb81de5b850c2b0af54da5760b9c1a
|
Provenance
The following attestation bundles were made for grimace_py-0.1.16-cp313-cp313-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on numpde/grimace-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grimace_py-0.1.16-cp313-cp313-manylinux_2_28_x86_64.whl -
Subject digest:
732528dfddb7eba05895dc464c63999bdf963b7ad5b5132b14c4529591fe0f98 - Sigstore transparency entry: 1740409477
- Sigstore integration time:
-
Permalink:
numpde/grimace-py@e3ac684853c780e00b519396a8758f19a7adde96 -
Branch / Tag:
refs/tags/v0.1.16 - Owner: https://github.com/numpde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e3ac684853c780e00b519396a8758f19a7adde96 -
Trigger Event:
push
-
Statement type:
File details
Details for the file grimace_py-0.1.16-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: grimace_py-0.1.16-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 773.1 kB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6e0d93d8e0dd304ba3f1e1d0b12449520a88cf9e5d891af74fa224e080481d7
|
|
| MD5 |
bf9378d31df0a4b996ba68bb7f59763c
|
|
| BLAKE2b-256 |
64e4998a60afab0af9852318deed21a2f3bcdbfed73899f48cf5a0898cee978c
|
Provenance
The following attestation bundles were made for grimace_py-0.1.16-cp312-cp312-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on numpde/grimace-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grimace_py-0.1.16-cp312-cp312-manylinux_2_28_x86_64.whl -
Subject digest:
e6e0d93d8e0dd304ba3f1e1d0b12449520a88cf9e5d891af74fa224e080481d7 - Sigstore transparency entry: 1740409484
- Sigstore integration time:
-
Permalink:
numpde/grimace-py@e3ac684853c780e00b519396a8758f19a7adde96 -
Branch / Tag:
refs/tags/v0.1.16 - Owner: https://github.com/numpde
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e3ac684853c780e00b519396a8758f19a7adde96 -
Trigger Event:
push
-
Statement type: