Qlens
A testing, debugging, and observability SDK for quantum programs, simulator-first.
Quantum software development lacks the testing and debugging ergonomics classical developers take for granted. Qlens packages statevector inspection, statistical output validation, and circuit equivalence checking into one pip-installable SDK for Qiskit and PennyLane, with a pytest-native testing API built on instrumented execution that captures the statevector after every gate.
import qlens
from qiskit import QuantumCircuit
def test_bell_distribution():
circuit = QuantumCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
result = qlens.run(circuit)
qlens.assert_distribution(result, {"00": 0.5, "11": 0.5}, seed=0)
The same test body works against a PennyLane QNode unchanged, and produces the same canonical results: Qlens defines one semantic convention (big-endian bitstrings, canonical basis ordering) and every backend converts at its own boundary.
Install
pip install qlens[qiskit]
Extras: qlens[qiskit], qlens[pennylane], or both. Python 3.11+. Simulator-only; no quantum hardware access is involved anywhere.
What it does
qlens.run(circuit): instrumented execution capturing the statevector after every gate, with lazy sampled counts.qlens.assert_distribution(result, expected): chi-square or KS validation of measurement output against an expected distribution, without hand-rolling the statistics.qlens.assert_unitary(circuit): unitarity within numerical tolerance.qlens.assert_equivalent(a, b): same unitary up to global phase, across different gate decompositions.- A bundled pytest plugin: fixtures and a
qlensmarker, registered on install. - A public backend contract with entry-point discovery, so further frameworks (Cirq and beyond) plug in as separate packages certified against a shipped conformance suite.
Documentation
- USAGE.md: the full manual with runnable examples.
- CONVENTIONS.md: the semantic conventions every backend follows.
- ARCHITECTURE.md: component diagram and contracts.
- CHANGELOG.md: dated changes per version.
Status
Pre-release. Not yet published to PyPI.
License
MIT.
Built by Mo Shehu — mohammedshehu.com
Release files for qlens 0.1.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 | |
|---|---|---|---|
| qlens-0.1.0.tar.gz | 29.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qlens-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.1 kB
Release files / qlens-0.1.0.tar.gz
| Download URL | qlens-0.1.0.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d36c88706d253a63c8ad15280a1e00dcc70afa210770c7826b65efc095fee039
|
|
BLAKE2b-256 checksum How to use checksums |
ea92e68154d40d4304358a20c53ebc80e7551c467bb9c5478171121d60b419e1
|
| 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 Aug 8, 2026.
Transparency logRelease files / qlens-0.1.0-py3-none-any.whl
| Download URL | qlens-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65e71c7a7dd9f46a5d64d399e2dbf62c9657e8b789eec01184d13385f0106b2f
|
|
BLAKE2b-256 checksum How to use checksums |
ca6510a100a58af5f82258495d0c737eb8a65f956f6e78b1f933135864597139
|
| 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 Aug 8, 2026.
Transparency log