Zirium
Zirium is a Rust library and command-line tool for reading, inspecting, editing, and writing textual MLIR, with typed Python bindings. It works without linking LLVM. The parser preserves the original bytes, including comments, whitespace, malformed syntax, and invalid UTF-8. A separate semantic representation supports verification and structural edits.
Version 0.0.12 is experimental. It targets MLIR 22.1 textual syntax and supports selected custom dialect forms. The API may change without a migration path; bytecode and ODS/TableGen loading are unsupported.
Installation
Install the Python package with:
python -m pip install zirium
Published wheels cover CPython 3.11 through 3.14 on Linux x86_64 and macOS arm64. Wheels are specific to each CPython version. Other platforms require a local source build and are unsupported.
Rust builds require Rust 1.88 or newer. From a source checkout, install the CLI with:
cargo install --path crates/zirium
The Python wheel does not include the CLI. The getting-started guide covers Rust usage and building the Python extension locally.
Command-line utility
The zirium binary queries and edits textual MLIR. Pass the query first,
followed by any input files. With no input files, it reads from standard input.
For example, this selects every arith.addi operation in input.mlir:
zirium 'filter(op("arith.addi"))' input.mlir
The query language reference lists every predicate and pipeline stage. The CLI examples show complete queries, dependency slices, and edits.
You can also run the binary from a source checkout with Cargo:
cargo run --quiet --bin zirium -- \
'filter(op("arith.addi"))' input.mlir
Python example
import zirium
source = """\
"builtin.module"() ({
%value = "example.make"() : () -> i32
"example.consume"(%value) : (i32) -> ()
}) : () -> ()
"""
parsed = zirium.parse_text(source)
assert parsed.original_bytes() == source.encode()
lowered = parsed.lower_strict("semantic")
if lowered.document is None:
for diagnostic in lowered.diagnostics:
print(diagnostic.range, diagnostic.message)
raise SystemExit(1)
document = lowered.document
document.validate_structure()
table = document.operation_table()
print([table.operation(index).name for index in range(table.count)])
print(document.canonical_bytes().decode(), end="")
A File owns the original bytes, tokens, concrete syntax tree (CST), and syntax
diagnostics. A Document owns resolved semantic data. Keeping them separate lets
you inspect malformed source without requiring a valid semantic model, and edit
semantic structure without manipulating syntax nodes.
Output modes
Zirium has three output paths, each with a different contract:
| Output | Source object | Contract |
|---|---|---|
| Original | Parsed file | Reproduces the input bytes exactly. |
| Canonical | Semantic document | Emits deterministic generic MLIR from semantic storage. |
| Preserving | Hybrid semantic document | Copies unchanged source and regenerates edited operations or blocks. |
Canonical output normalizes formatting and SSA names and does not preserve comments or aliases. Use original output to reproduce the input, or hybrid retention when edits should preserve unrelated source text.
Dialect support
Generic quoted operations are handled without a dialect registry. Unknown dialect types and attributes keep their balanced bodies as opaque values.
The baseline registry covers a small set of Builtin, Func, Arith, and CF operations. Bundled presets expose selected custom forms from other dialects for structural queries. Unsupported forms use best-effort recovery; presets do not implement full dialect verification or execution.
The custom-format guide explains registry configuration, operation shapes, and use from Rust, Python, and the CLI. The preset reference groups the available dialects and links to their exact registry definitions.
The corpus notes
describe how syntax compatibility is checked against llvmorg-22.1.0.
Repository layout
crates/zirium/ Core Rust library
crates/zirium-python/ PyO3 extension module
python/zirium/ Python package and type declarations
python/tests/ Python API tests
tests/corpus/ Versioned MLIR compatibility corpus
docs/ Usage, compatibility, and architecture notes
fuzz/ Lexer and parser fuzz targets
The architecture notes include the syntax representation baseline and processing benchmarks.
Development
Run the Rust workspace tests from the repository root:
cargo test --workspace
The compatibility guide lists the full CI checks, supported toolchains, and wheel checks. The getting-started guide covers Python development, and the release guide describes packaging and publication.
License
Zirium's original code is available under the MIT or Apache 2.0 license. Some MLIR-derived or adapted test material carries the source attribution and license notices recorded in the corpus manifest.
Release notes are recorded in the changelog.
Metadata
Release files for zirium 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zirium-0.0.12.tar.gz | 283.9 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| zirium-0.0.12-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.17+ x86-64 | Details |
| zirium-0.0.12-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| zirium-0.0.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.17+ x86-64 | Details |
| zirium-0.0.12-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| zirium-0.0.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64 | Details |
| zirium-0.0.12-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| zirium-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64 | Details |
| zirium-0.0.12-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
Total release size: 9.2 MB
Release files / zirium-0.0.12.tar.gz
| Download URL | zirium-0.0.12.tar.gz |
|---|---|
| Size | 283.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06ced62d7524d01d0baeae7df873f4e7c2dad1b326f848ff346ad07fe3ac301c
|
|
BLAKE2b-256 checksum How to use checksums |
e8dcfd2f5fc21ff856ddb21780ed828d177b1adca91a2e419fcc6b7131449b3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zirium-0.0.12-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a6c11e78088fab96c133244a15e28b67e2c0fa7baccd7d77b222348f1cbcbd31
|
|
BLAKE2b-256 checksum How to use checksums |
7e7e3bdfa9e3d80e56166b84afba391d09e04e0adc4448b6880bed2103e01ff0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | zirium-0.0.12-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d861293a89eb747bd187f45ed4cb702f6f518cd030ec6de8e3258e775037744f
|
|
BLAKE2b-256 checksum How to use checksums |
c55caf0e495503a2b3ef767e59a6080520007828592ea8674c709d78b4b2d971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zirium-0.0.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
9c902cde029369d8f27af8a4f25dc3e2c44b27d6007774e6d9f32965a8f37645
|
|
BLAKE2b-256 checksum How to use checksums |
f6e846f65f9676a817349a8dd906a08951043d56230ced4d29ab0eeb225b1cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | zirium-0.0.12-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8b697f468bd92f099521bea39e1aa429e6a4c63e18ecb735f497c9b1e0ff9b38
|
|
BLAKE2b-256 checksum How to use checksums |
ea9a5a8ccbf9102be817810fc836d8ac957d9c468d02aa4b8dca865188b8f026
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zirium-0.0.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0eceb6999c6339820a562d66bb9dba8d73a6463bc7b02372ff55f41463ac0e7d
|
|
BLAKE2b-256 checksum How to use checksums |
01141c0d58c692e3b2e1ec8abe5b7410ba1965ff44bccb4f1970d84724983267
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | zirium-0.0.12-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8f0ae636ec5dc146f08dc563d399be839f230e5ffa7c66575c3a44c2229baff2
|
|
BLAKE2b-256 checksum How to use checksums |
cbe5bb00632439e6eef999291cad056b0984961f43e68932b0205ce1a3c5a9ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | zirium-0.0.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d7b3a8d224ff6d5c547277c6d19f22d1519f5a958ff25b2fe28edabe23276238
|
|
BLAKE2b-256 checksum How to use checksums |
7ca42c9f05a5f17f3e22b155364377a33e538ef32feb1f81d6e130c1164c6334
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logRelease files / zirium-0.0.12-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | zirium-0.0.12-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
379d35948e75a7b856f5b06ffc7b7ec6637d4d1658e9a6075e46241c2179d9ed
|
|
BLAKE2b-256 checksum How to use checksums |
6649198eb30c306225e4b33a493a4ea53acc7442f956ee016eda32ee68cd84d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 10, 2026.
Transparency logSecurity for zirium 0.0.12
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 9 files in this release have been uploaded with provenance metadata.
Attestation for zirium-0.0.12.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 Sep 10, 2026.
Transparency logA 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.