Skip to main content

qcdiff

Semantic diff for OpenQASM 3 quantum circuits. qcdiff compares two QASM programs at the gate level instead of the text level, so comment, whitespace, and declaration-order changes do not count as differences. Built for CI pipelines and code review of transpiler output.

This package is the Python binding of the Rust qcdiff tool.

Install

pip install qcdiff

Usage

import qcdiff

report = qcdiff.diff_files("reference/ghz.qasm", "build/ghz.qasm")
if report.has_changes():
    print(report)          # the same text the CLI prints

# In a pytest regression gate:
assert not qcdiff.diff_files("reference/ghz.qasm", "build/ghz.qasm")

With Qiskit circuits, export to QASM 3 first:

from qiskit import qasm3

report = qcdiff.diff_sources(qasm3.dumps(circuit_a), qasm3.dumps(circuit_b))
print(report.added, report.removed, report.modified)
for line in report.lines:
    if line.change != "same":
        print(line)

diff_sources and diff_files raise qcdiff.QasmError on OpenQASM 2 input or parse errors.

qcdiff reports what changed, not whether the circuits are equivalent; for formal equivalence checking use mqt-qcec.

License

Apache-2.0

Metadata

Release files for qcdiff 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qcdiff 0.2.1
File Size Uploaded Provenance Actions
qcdiff-0.2.1.tar.gz 28.4 kB Without provenance Details for qcdiff-0.2.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for qcdiff 0.2.1
File Actions
qcdiff-0.2.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for qcdiff-0.2.1-cp39-abi3-win_amd64.whl
qcdiff-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for qcdiff-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
qcdiff-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for qcdiff-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
qcdiff-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.9 abi3 macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 Details for qcdiff-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 2.9 MB

Release files / qcdiff-0.2.1.tar.gz

Download URL qcdiff-0.2.1.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
03ce1bf2b535d2630c531d795dd348415207069fa1d07f598291a865ce487995
BLAKE2b-256 checksum
How to use checksums
904146abacf30f928524fffc2c38c5419260652b3a561636eaeabe4c4c58d4b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / qcdiff-0.2.1-cp39-abi3-win_amd64.whl

Download URL qcdiff-0.2.1-cp39-abi3-win_amd64.whl
Size 488.0 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
95cfaef8725918311a9fbc9b406a7c275ccdd3a3ff28bf3ffc22e294154cf067
BLAKE2b-256 checksum
How to use checksums
e6fa7d5e382c186789706512169a0c751cd9c66b79e56d0c44c277dcd921c5c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / qcdiff-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qcdiff-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 643.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
be5beda62731ce4d23c9308209e22aee5fa7506ec4f8466748240c7c24c64a32
BLAKE2b-256 checksum
How to use checksums
4e9ee1ab099264e293a906ea5475ede06639ac960fb9ad3c1fb8c5f5299b853e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / qcdiff-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL qcdiff-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 628.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
95ff0446802442b9504fd259ca04374591788dc97a779169aee3790f4088bb66
BLAKE2b-256 checksum
How to use checksums
1065503bcab8aefe0a42e64f438c166754d8def7256bcc567059bd229c42371d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / qcdiff-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL qcdiff-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 1.1 MB
Tags CPython 3.9 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bf91a2e5760fad7aff2ac69bfbbcf126d4691b49805f121f76a2d05a7cc676a6
BLAKE2b-256 checksum
How to use checksums
a99bd16d30f03599e6f13389359d7c8e2e01e786497ea087c550098c842875f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for qcdiff 0.2.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

5 release files No provenance

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