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

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.0
File Size Uploaded Provenance Actions
qcdiff-0.2.0.tar.gz 19.5 kB Without provenance Details for qcdiff-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for qcdiff 0.2.0
File Actions
qcdiff-0.2.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for qcdiff-0.2.0-cp39-abi3-win_amd64.whl
qcdiff-0.2.0-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.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
qcdiff-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for qcdiff-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
qcdiff-0.2.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl CPython 3.9 abi3 macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details for qcdiff-0.2.0-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.0.tar.gz

Download URL qcdiff-0.2.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
86ab8428bd261614aae6f34d6584b5f18fbd14974cdd19c137ab210c91312a10
BLAKE2b-256 checksum
How to use checksums
741992bc1d901ea1d6433d61dc3fd22ce9a1fcf248c289312d65047db3388b7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL qcdiff-0.2.0-cp39-abi3-win_amd64.whl
Size 478.2 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
14155ee738a6c1bad89eec3a9517e651bf3ec3e6800483987e8384f0e4d8b262
BLAKE2b-256 checksum
How to use checksums
ff8e4e6d4e0c5223d5808580a6325b248c03268cb1c2fb3f49bb5e2b589cd747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL qcdiff-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 638.9 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
71570f8736dbc109266e89ea6ddf2c10b0e5b449f59803ffdb08e1fc6608dfcb
BLAKE2b-256 checksum
How to use checksums
a0b61c133e71f51546291a12e01e863a981c50125e97e6f609c9b341e72b05e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL qcdiff-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 623.3 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a1836a8e417f25b2d20e7c677ed657668befc891519df56bbfcad3feceaaafb9
BLAKE2b-256 checksum
How to use checksums
fe91a50081fbfe97afdaa69d60b22c7a0fc79f5d8bc01cba09d0b5b153c46244
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL qcdiff-0.2.0-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
d8ec209cba68e365af497b0f12317762e5cc53ab19c6f14a037493246e8f03c5
BLAKE2b-256 checksum
How to use checksums
444c5561c691df6ae1f9e3689a1ec130443c2fd8720d65a5fbcc8da86f6e303a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for qcdiff 0.2.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.

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