CleitonForge
Neutral benchmarking layer for quantum circuit simulators — Python bindings
CleitonForge is an open-source, Rust-powered neutral benchmarking and interoperability layer for quantum computing simulators, created by Cleiton Augusto Correa Bezerra.
This package (cleitonforge) exposes the full CleitonForge engine to Python —
build circuits, run simulations, parse OpenQASM, and measure performance metrics,
all from Python with the speed of native Rust.
Install
pip install cleitonforge
No Rust toolchain required — pre-built wheels for Linux, macOS and Windows.
Validating QEC compiler passes
pip install "cleitonforge[qec]"
A pass that rewrites an error-correction circuit is often accepted because the
detector error model (DEM) is the same before and after. That comparison cannot
see a deterministic Pauli inserted by the pass: the measurement outcomes and the
detector reference move together, so the DEM is identical while the circuit
computes something else. cleitonforge.qec checks the circuit itself, through
its stabiliser flows in both directions, and says when a DEM check would have
been fooled.
from cleitonforge import qec
verdict = qec.check_pass(before, after) # stim.Circuit, or deltakit_circuit.Circuit
verdict.equivalent # flows match both ways
verdict.dem_equal # what a DEM comparison says
verdict.dem_blind # DEM equal although the circuit changed
verdict.witness # a flow only one of the two circuits has
It also measures how much a check can see. oracle_power applies mutations that
change a circuit and counts how many of them a given oracle reports. On a
distance-3 rotated surface code, 3 rounds, 20 mutants of each kind:
| mutation | DEM comparison | flows |
|---|---|---|
| drop a two-qubit gate | 20/20 | 20/20 |
| drop the control of a CX | 20/20 | 20/20 |
| wrong measurement basis | 20/20 | 20/20 |
| X before a measurement | 0/20 | 20/20 |
The flows are also the reference that decides which mutants changed the circuit, so their column is 100% by construction. The figure that matters is the DEM's zero. Pass your own test as the oracle to see what it misses:
qec.oracle_power(my_check, circuits) # my_check(before, after) -> bool
The smallest case is in qec.witness(): four instructions and a noise channel.
The analysis is in the paper,
doi:10.5281/zenodo.22802524.
Quick start
Build and run a circuit
import cleitonforge as cf
# Bell state
circuit = cf.Circuit(2)
circuit.h(0)
circuit.cx(0, 1)
result = cf.run(circuit, shots=1024)
print(result.counts) # {'00': 512, '11': 512}
print(result.top_states(2)) # [('11', 0.5), ('00', 0.5)]
Run from OpenQASM
qasm = """
OPENQASM 2.0;
qreg q[2];
h q[0];
cx q[0],q[1];
"""
result = cf.run_qasm(qasm, shots=1024)
print(result.counts)
Validate a circuit without simulating
info = cf.validate_qasm(qasm)
# {'qubits': 2, 'gates': 2, 'depth': 2}
Reproducible results with seed
r1 = cf.run(circuit, shots=1024, seed=42)
r2 = cf.run(circuit, shots=1024, seed=42)
assert r1.counts == r2.counts # always True
Supported gates
Full OpenQASM 3 stdgates.inc gate set: h, x, y, z, s, sdg,
t, tdg, sx, sxdg, rx, ry, rz, p, u, cx, cy, cz,
ch, csx, crx, cry, crz, cp, cu, swap, ccx, cswap.
IBM/Qiskit aliases (id, cnot, toffoli, fredkin, u2, u3) are
automatically translated.
Backends
| Name | Description |
|---|---|
"statevector" |
Native Rust state-vector simulator (default) |
"quantrs2" |
QuantRS2 backend |
result = cf.run(circuit, shots=1024, backend="quantrs2")
Statevector access
result = cf.run(circuit, shots=0) # shots=0 → exact statevector
for re, im in result.statevector:
print(complex(re, im))
Why CleitonForge
The quantum computing ecosystem is fragmented: Qiskit, Cirq, PennyLane, Amazon Braket, and multiple Rust simulators each define benchmarks differently. CleitonForge is the neutral arbiter — it measures and compares any backend using the same canonical IR, without favoring any vendor.
- Canonical IR: every gate carries provenance (source framework, original name)
- Plugin architecture: add any backend via the
SimulationBackendRust trait - OpenQASM 2 and 3 parsing natively in Rust
- Metrics over canonical IR guarantee fair cross-backend comparison
CLI tool
The Rust CLI (cforge) is available in the main repository:
cforge run --circuit bell.qasm --backends statevector,quantrs2
cforge validate --circuit circuit.qasm
Author
Cleiton Augusto Correa Bezerra Brazilian systems analyst and quantum computing researcher. GitHub · Email
License
Apache 2.0 — same license as OpenQASM and the Rust ecosystem.
Metadata
Release files for cleitonforge 0.6.0
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 | Actions |
|---|---|---|---|---|
| cleitonforge-0.6.0.tar.gz | 102.9 kB | With provenance | Details for cleitonforge-0.6.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cleitonforge-0.6.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details for cleitonforge-0.6.0-cp38-abi3-win_amd64.whl |
| cleitonforge-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for cleitonforge-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| cleitonforge-0.6.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 | Details for cleitonforge-0.6.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
Total release size: 5.1 MB
Release files / cleitonforge-0.6.0.tar.gz
| Download URL | cleitonforge-0.6.0.tar.gz |
|---|---|
| Size | 102.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cfe96b1740feb921fd0f80b39c94d4cefd7d936f7afa02a390b8e400c7b126a
|
|
BLAKE2b-256 checksum How to use checksums |
5019ac4cdbf102666ba1230fc139aa9f702bb44f924f4c5f297d848446d2fa84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logRelease files / cleitonforge-0.6.0-cp38-abi3-win_amd64.whl
| Download URL | cleitonforge-0.6.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
091f845d48f5e8873bf14607d22588ed04caa35cce71966e75125d3300957e53
|
|
BLAKE2b-256 checksum How to use checksums |
57e6030549b7b6ac5f0b7fadd55c2c55049b90cb2e1d452d370f2fd75b4a16a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logRelease files / cleitonforge-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | cleitonforge-0.6.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d38d0e7b902de6f872d9fd9ec3d24e4678a1ff3fd09774f904d71da4e0af2063
|
|
BLAKE2b-256 checksum How to use checksums |
211cf0944561da31be593b15533f364131373828478f0ff0e222e0562505206e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logRelease files / cleitonforge-0.6.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
| Download URL | cleitonforge-0.6.0-cp38-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3a220252816fd4fae5b7803869f578eb53ab817c8ec19fc4fd0cc94380e760ab
|
|
BLAKE2b-256 checksum How to use checksums |
1d0db067afdeb8448382cec116e50f5b1d50013db36311f4eaf4a4e77608162a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 24, 2026.
Transparency logSecurity for cleitonforge 0.6.0
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 4 files in this release have been uploaded with provenance metadata.
Attestation for cleitonforge-0.6.0.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 Nov 24, 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.