Skip to main content

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(...) or MolToSmilesDeterminizedDecoder(...).
  • 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(...) and PreparedMol.

Documentation

Please find the main documentation at numpde.github.io/grimace-py.

Install

Package metadata declares Python >=3.11 and rdkit>=2026.3. See Runtime for the exercised wheel and source-distribution matrix.

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.

Metadata

Release files for grimace-py 0.1.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grimace-py 0.1.18
File Size Uploaded Provenance Actions
grimace_py-0.1.18.tar.gz 5.4 MB With provenance Details for grimace_py-0.1.18.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for grimace-py 0.1.18
File Actions
grimace_py-0.1.18-cp314-cp314-manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64 Details for grimace_py-0.1.18-cp314-cp314-manylinux_2_28_x86_64.whl
grimace_py-0.1.18-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for grimace_py-0.1.18-cp313-cp313-manylinux_2_28_x86_64.whl
grimace_py-0.1.18-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details for grimace_py-0.1.18-cp312-cp312-manylinux_2_28_x86_64.whl
grimace_py-0.1.18-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details for grimace_py-0.1.18-cp311-cp311-manylinux_2_28_x86_64.whl

Total release size: 8.5 MB

Release files / grimace_py-0.1.18.tar.gz

Download URL grimace_py-0.1.18.tar.gz
Size 5.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c8bcf94fa8ac2b6033607d59366e7c09415f3d4cb55e1c8b9f42a673d7bd8026
BLAKE2b-256 checksum
How to use checksums
da4d3b47853fa67adcbc071609b15cc43f88a7cb92ac8eeef7165ae860d74ab6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 14, 2026.

Transparency log

Release files / grimace_py-0.1.18-cp314-cp314-manylinux_2_28_x86_64.whl

Download URL grimace_py-0.1.18-cp314-cp314-manylinux_2_28_x86_64.whl
Size 776.5 kB
Tags CPython 3.14 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
490a568d9065be54c14dc598ecdb21758f7378e0af2503600912a28bffbabee1
BLAKE2b-256 checksum
How to use checksums
6c5ce4783b3c153cf1165f64f64714771e2c431b2f838ba4ea5fdfc8915802b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 14, 2026.

Transparency log

Release files / grimace_py-0.1.18-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL grimace_py-0.1.18-cp313-cp313-manylinux_2_28_x86_64.whl
Size 778.0 kB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2ba0bbda805b1f56ecae3d7ac181d81491eee897078b6c3da0e0a3163f56bca6
BLAKE2b-256 checksum
How to use checksums
da43b7162a69a4f0bba58b8c44f797195426266bea62728c6913ffeaf4578ac4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 14, 2026.

Transparency log

Release files / grimace_py-0.1.18-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL grimace_py-0.1.18-cp312-cp312-manylinux_2_28_x86_64.whl
Size 778.3 kB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
14589d18295e418b5570566953250b5b039a4c20c79ef7815eb221e98ff239ee
BLAKE2b-256 checksum
How to use checksums
289747ec9791136a323d518ec56ae04e5e1667fb795abca36f14a5b456630987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 14, 2026.

Transparency log

Release files / grimace_py-0.1.18-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL grimace_py-0.1.18-cp311-cp311-manylinux_2_28_x86_64.whl
Size 782.4 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
58d78d19d4c11f9a2131eeaaf61076b244481fffc22e838dce6d661015b6b8e0
BLAKE2b-256 checksum
How to use checksums
a453042853791959e8a7532f948488ff6858a821af4ab73291bdca075bde2755
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

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 Jun 14, 2026.

Transparency log

Security for grimace-py 0.1.18

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 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for grimace_py-0.1.18.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 Jun 14, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page