emlint
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, theduplicatescheck (warning) may report mechanisms that share a detector signature after graphlike decomposition as "duplicates". This is expected decomposition output, not a concatenation bug. Use thegraphlike-decoderprofile 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
Built Distribution
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2479537afdd4ca7caf5ad40b041109968cc4dee17af0920d61d28a3b69fb138e
|
|
| MD5 |
aef95ecc0de18fff0876a63d4cffa6fe
|
|
| BLAKE2b-256 |
c4dcff60ea469bda5dd38a29a9df841d4d5c70778ad0276f98616fc2079788d4
|
Provenance
The following attestation bundles were made for emlint-0.2.2.tar.gz:
Publisher:
publish.yml on MathysRennela/emlint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlint-0.2.2.tar.gz -
Subject digest:
2479537afdd4ca7caf5ad40b041109968cc4dee17af0920d61d28a3b69fb138e - Sigstore transparency entry: 2730802937
- Sigstore integration time:
-
Permalink:
MathysRennela/emlint@7f791c8d2632625459eed1a8b554378f9362891d -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/MathysRennela
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f791c8d2632625459eed1a8b554378f9362891d -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c49b0768205395c1d43771574f5f6fb8173bc6d2c071360d355a04b0bfcb8831
|
|
| MD5 |
8a75a4fc67f0de7da543935121e392b7
|
|
| BLAKE2b-256 |
ea9f03d70e19f854e71431d8ec4ade5c2b87bb5303528fcb5404ab2ea2027489
|
Provenance
The following attestation bundles were made for emlint-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on MathysRennela/emlint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emlint-0.2.2-py3-none-any.whl -
Subject digest:
c49b0768205395c1d43771574f5f6fb8173bc6d2c071360d355a04b0bfcb8831 - Sigstore transparency entry: 2730803219
- Sigstore integration time:
-
Permalink:
MathysRennela/emlint@7f791c8d2632625459eed1a8b554378f9362891d -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/MathysRennela
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7f791c8d2632625459eed1a8b554378f9362891d -
Trigger Event:
push
-
Statement type: