Skip to main content

emlint

emlint logo

PyPI

stim simulates. sinter samples. emlint verifies.

emlint is a static linter for Stim Detector Error Models (DEMs). It finds structural problems before simulation.

v0.2 is preliminary. The user-facing behavior is usable, but internal APIs and implementation details may change before v1.0.

Quick start

Install emlint:

pip install emlint

Lint a DEM file or raw DEM text:

emlint check circuit.dem
emlint check 'error(0.01) D0 L0
detector D0'

A failing result includes a counter-example identifying the relevant mechanism, detector, or observable. Select checks with --only/--ignore, or emit SARIF for code-scanning tools:

emlint check circuit.dem --only detectability,sensitivity
emlint check circuit.dem --format sarif > emlint.sarif

Project defaults can be placed in pyproject.toml under [tool.emlint]. For all command options, configuration examples, and exit codes, see the CLI reference.

Python

import emlint
import stim

circuit = stim.Circuit.generated(
    "surface_code:rotated_memory_z",
    distance=3,
    rounds=3,
    after_clifford_depolarization=0.001,
)
report = emlint.check(circuit.detector_error_model())
print(emlint.format_text(report))

emlint.check() also accepts a raw DEM string or an explicit pathlib.Path.

Documentation

Guide Use it for
CLI reference Commands, options, output, and exit codes
Check catalog What the six checks detect and how to interpret findings

Note: on DEMs produced with decompose_errors=True, the duplicates check (warning) may report mechanisms that share a detector signature after graphlike decomposition as "duplicates". This is expected decomposition output, not a concatenation bug. Use the graphlike-decoder profile context when a graphlike matcher is the intended decoder. | Debugging guide | Check-specific causes and investigation steps | | Formal grounding | DEM vocabulary and formal properties | | v0.2 limitations | Scope, warnings, repeat blocks, and provisional behavior |

CI

For a minimal GitHub Actions setup, install emlint and run it on changed DEM files:

- name: Install emlint
  run: pip install emlint
- name: Lint DEM files
  run: find . -name "*.dem" -print0 | xargs -0 -r -n1 emlint check

For local commits, the repository includes a pre-commit hook configuration:

pip install pre-commit
pre-commit install

The hook runs emlint check --severity error on staged .dem files. Warning-only findings remain non-blocking; input failures still return exit code 3.

Contributing

See CONTRIBUTING.md for development setup, how to add a check, test requirements, and quality gates.

Acknowledgments

emlint is developed with AI assistance for scaffolding, test generation, red-teaming, and documentation. All design decisions, technical content, and final code are reviewed and owned by the maintainers.

This project is funded by a Mozilla Foundation fellowship and supported by the Unitary Foundation.

License

Apache 2.0

Download files

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

Source Distribution

emlint-0.2.1.tar.gz (79.4 kB view details)

Uploaded Source

Built Distribution

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

emlint-0.2.1-py3-none-any.whl (34.5 kB view details)

Uploaded Python 3

File details

Details for the file emlint-0.2.1.tar.gz.

File metadata

  • Download URL: emlint-0.2.1.tar.gz
  • Upload date:
  • Size: 79.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for emlint-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b8823e6acb53e04f1ecee70a9605d495c49d984cfb1fb9efd222b6a338956cf4
MD5 394ec47cc05efa267934b8d64f7ed6fa
BLAKE2b-256 d694b01b9f3294f549f82e8fc009f5975c692503d7aa3f12de28687a98ac45c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for emlint-0.2.1.tar.gz:

Publisher: publish.yml on MathysRennela/emlint

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

File details

Details for the file emlint-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: emlint-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 34.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for emlint-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e93b3bf3d8d6bb0a4315b1ae84a41e7c2adb4e00a9fa681dda40a21b6691551b
MD5 6e895f6872ef5afbcfeac6a4e6fe681b
BLAKE2b-256 52c997a5e32ee73847a4bc13072d89d6db0479fb45b786067c0bd17df9114afc

See more details on using hashes here.

Provenance

The following attestation bundles were made for emlint-0.2.1-py3-none-any.whl:

Publisher: publish.yml on MathysRennela/emlint

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

Release history Release notifications | RSS feed

0.2.2

2 files

This release

0.2.1 This release

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

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