Skip to main content

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, 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
  • prepared molecule bytes for reuse outside RDKit

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 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(...) or MolToSmilesDeterminizedDecoder(...).
  • Diagnose rejected candidates with MolToSmilesDeviation(...).
  • Build dataset token coverage with MolToSmilesTokenInventorySuperset(...).
  • Reuse prepared molecules with PrepareMol(...) and PreparedMol.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grimace_py-0.1.14.tar.gz (5.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

grimace_py-0.1.14-cp313-cp313-manylinux_2_28_x86_64.whl (770.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

grimace_py-0.1.14-cp312-cp312-manylinux_2_28_x86_64.whl (771.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

File details

Details for the file grimace_py-0.1.14.tar.gz.

File metadata

  • Download URL: grimace_py-0.1.14.tar.gz
  • Upload date:
  • Size: 5.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for grimace_py-0.1.14.tar.gz
Algorithm Hash digest
SHA256 1c1e167241b30ec50ebed06fc21a5e65bfd1e6b2ba69d44d100979b332276b92
MD5 c645a631e62ac099d1e6308feabf88cd
BLAKE2b-256 6ef19ddd06f6a8c9c7546fdb978aaddd522e059e37966325afa02a2c69da7a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for grimace_py-0.1.14.tar.gz:

Publisher: release.yml on numpde/grimace-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grimace_py-0.1.14-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for grimace_py-0.1.14-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ad00d62072c341acb78fe0cf168a2c382631668d22f75d5e79d8991533a4e6b
MD5 ce3270d900d05506fc3aa6d3f03fe738
BLAKE2b-256 969c1fde31764e03d199222f6d6c8bd3ab2661da4b203fc1854dfab5442865c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for grimace_py-0.1.14-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: release.yml on numpde/grimace-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grimace_py-0.1.14-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for grimace_py-0.1.14-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 67cbbbcb14e9979b34e381f796047bb40bb1b81db3dcfd182cbf37718220166e
MD5 d9dbe04ce23959c8ca47b76ba7937a3c
BLAKE2b-256 5a7d7d278cfc0dd50a52724e5be09f096f4ba962bef274dd34a2dd6b5bc80ba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for grimace_py-0.1.14-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: release.yml on numpde/grimace-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page