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
Agent integration guide Running emlint in a coding-agent fix-loop: exit-code handling, JSON contract, context declaration
Check catalog What the six checks detect and how to interpret findings, plus the machine-readable output contract
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

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.

Exit codes

Code Meaning
0 All checks passed
1 At least one error-severity finding
2 Warnings only
3 Unlintable input (unreadable or unparseable)

Treat exit code 3 as an input failure, not as findings: an agent loop that parses the report on exit 3 would reason about a DEM that emlint never saw.

Epistemic boundary: emlint analyzes DEMs only. Its findings establish structural properties of the DEM itself; they do not establish that the underlying circuit is semantically correct, nor that a decoder succeeds. Circuit-level verification (e.g. with stim) remains necessary.

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.2.tar.gz (84.5 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.2-py3-none-any.whl (37.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: emlint-0.2.2.tar.gz
  • Upload date:
  • Size: 84.5 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.2.tar.gz
Algorithm Hash digest
SHA256 2479537afdd4ca7caf5ad40b041109968cc4dee17af0920d61d28a3b69fb138e
MD5 aef95ecc0de18fff0876a63d4cffa6fe
BLAKE2b-256 c4dcff60ea469bda5dd38a29a9df841d4d5c70778ad0276f98616fc2079788d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for emlint-0.2.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: emlint-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 37.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c49b0768205395c1d43771574f5f6fb8173bc6d2c071360d355a04b0bfcb8831
MD5 8a75a4fc67f0de7da543935121e392b7
BLAKE2b-256 ea9f03d70e19f854e71431d8ec4ade5c2b87bb5303528fcb5404ab2ea2027489

See more details on using hashes here.

Provenance

The following attestation bundles were made for emlint-0.2.2-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

This release

0.2.2 This release

2 files

0.2.1

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