Skip to main content

The quantum DevOps toolchain: statistical testing, cost intelligence, hardware routing, spend guards, and observability for quantum programs

Project description

Qontinuum

PyPI CI Python License

CI/CD, noise-aware regression testing, and cost intelligence for quantum programs.

๐ŸŒ Website ยท ๐Ÿ“š Docs ยท ๐Ÿ“Š Live demo dashboard ยท ๐Ÿ“– Explainer

qont test and qont cost terminal demo

Quantum programs don't return values โ€” they return probability distributions sampled from noisy hardware. assert result == expected doesn't work, and nothing in the classical CI toolchain knows that. Qontinuum does.

  • qont test โ€” a pytest-style runner for quantum circuits with statistical assertions: total variation distance with shots-aware soundness floors, chi-squared tests, Hellinger fidelity, and snapshot baselines committed as JSON.
  • qont cost โ€” estimates what your suite would cost on real hardware across providers (IonQ, Rigetti, IQM, AQT via Braket; IBM; Azure Quantum) before you spend a cent.
  • qont route โ€” recommends hardware for your workload: estimated success probability ร— price, ranked by --optimize cost|fidelity|value.
  • qont run --on ibm:โ€ฆ --max-cost 5 โ€” executes the suite on real hardware behind an all-or-nothing spend guard (default budget: $0 โ€” it refuses until you authorize).
  • qont ci โ€” one command for CI: run the suite, write a markdown report.
  • qont dashboard โ€” renders run history as a self-contained HTML observability dashboard (status timeline, per-check statistic trends vs thresholds).
  • qont diff / qont hash โ€” semantic, register-name-agnostic circuit diffing and content addressing.
  • GitHub Action โ€” posts a sticky PR comment with regression results and the cost table.
  • Noise-aware testing โ€” simulate against real IBM device calibration data, offline, for free.
  • Bring your own SDK โ€” load_circuit also accepts Cirq circuits and PennyLane tapes.

โ€ฆand that's just the core. v0.2 is a full toolchain โ€” 110 commands translating the DevOps stack to quantum:

qont lint ruff for quantum tests โ€” 9 rules incl. the statistical soundness floor (Q001)
qont noise headroom load-testing for quantum โ€” how much calibration drift survives your test?
qont history bisect git-bisect for physics โ€” which run first crossed the threshold?
qont budget QPU FinOps โ€” monthly/total caps enforced before submission
qont test --cached build caching for simulation โ€” content-addressed seeded results
qont fuzz flakiness hunting โ€” empirical pass rates with Wilson intervals
qont pack reproducibility bundles โ€” verify re-runs and two-sample-compares
qont shots plan shot-count audits โ€” the napkin statistics, mechanized
qont report junit quantum checks rendered natively in Jenkins/GitLab/Buildkite
qont explain failure forensics: which outcomes drove the statistic, and why
+ circuit device registry stats bench watch config env doctor init mock schedule โ€ฆ the full plumbing

Install

pip install qontinuum          # core
pip install 'qontinuum[ibm]'   # + IBM calibration noise models

Quick start

Write a quantum test in any file named q_test_*.py:

from qiskit import QuantumCircuit
from qontinuum import qtest, assert_distribution

@qtest(shots=4000)
def bell_pair():
    qc = QuantumCircuit(2)
    qc.h(0)
    qc.cx(0, 1)
    qc.measure_all()
    return qc

@bell_pair.check
def is_maximally_entangled(result):
    assert_distribution(result, {"00": 0.5, "11": 0.5}, tvd_threshold=0.05)
$ qont test
โœ“ q_test_bell.py::bell_pair  aer, 4000 shots, 30 ms
    โœ“ is_maximally_entangled

1 passed, 0 failed, 0 errors

Statistics done right

Sampling noise means even a perfect circuit never reproduces a distribution exactly. Every assertion is shots-aware: if your threshold is below what the shot count can statistically resolve, Qontinuum refuses to run a test that would be flaky by construction โ€” and tells you the shot count that would fix it:

! is_maximally_entangled  tvd_threshold=0.01 is below the sampling noise floor 0.0289
  at 4000 shots: even a perfect result would fail ~1% of the time.
  Use at least 33380 shots or raise the threshold to >= 0.0289.

Test against real hardware noise โ€” offline and free

@qtest(shots=4000, backend="ibm:manila")   # bundled real calibration snapshot
def bell_under_noise(): ...

@qtest(shots=4000, backend="ibm:brisbane@live")  # today's live calibration (free IBM account)
def bell_today(): ...

Snapshot testing for quantum

@qtest(shots=4000, snapshot=True)
def ghz_5(): ...

qont snapshot update records the distribution as a golden baseline (keyed by the circuit's content hash). Later runs are compared with a two-sample homogeneity test โ€” if the circuit changes, the snapshot is flagged stale for review, exactly like Jest.

Know the cost before you run on hardware

$ qont cost
             Estimated hardware cost โ€” 3 test(s), 12000 total shots
โ”ƒ Provider      โ”ƒ Device                โ”ƒ Est. cost โ”ƒ
โ”‚ AWS Braket    โ”‚ Rigetti Cepheus       โ”‚     $6.00 โ”‚
โ”‚ IBM Quantum   โ”‚ Heron (Pay-As-You-Go) โ”‚     $9.61 โ”‚
โ”‚ AWS Braket    โ”‚ IQM Garnet            โ”‚    $18.30 โ”‚
โ”‚ Azure Quantum โ”‚ IonQ Aria 1           โ”‚    $63.29 โ”‚
โ”‚ AWS Braket    โ”‚ IonQ Forte            โ”‚   $960.90 โ”‚
โ”‚ Azure Quantum โ”‚ Quantinuum H2         โ”‚ 137.4 HQC โ”‚

Same suite, $6 or $961, depending on where you run it. That's why this table belongs on every pull request.

Route to the right hardware

$ qont route --optimize value
โ”ƒ # โ”ƒ Provider    โ”ƒ Device          โ”ƒ Est. success/shot โ”ƒ Est. cost โ”ƒ $ / success โ”ƒ
โ”‚ 1 โ”‚ AWS Braket  โ”‚ Rigetti Cepheus โ”‚             71.0% โ”‚    $10.00 โ”‚      $14.08 โ”‚
โ”‚ 2 โ”‚ IBM Quantum โ”‚ Heron (PAYG)    โ”‚             93.3% โ”‚    $16.01 โ”‚      $17.17 โ”‚

Cheap-but-noisy vs pricey-but-clean, resolved with one number.

Run on real hardware โ€” without surprise bills

qont run --on ibm:ibm_brisbane --dry-run --max-cost 5    # estimate only
qont run --on braket:rigetti_cepheus --max-cost 5        # refuses if estimate > $5

The guard is all-or-nothing: the whole suite is priced before the first shot is submitted, and the default budget is $0.

Watch your suite over time

Every run appends to .qontinuum/history.jsonl; qont dashboard turns it into a single-file HTML dashboard โ€” status timeline, each check's statistic trending against its threshold, cost per run. No server, no JavaScript, works as a CI artifact.

Diff circuits, not files

$ qont diff old.qasm new.qasm
- cx q[0, 1]
+ cx q[1, 0]
1 ops added, 1 removed

Register renames and formatting don't show up โ€” only semantic changes do (the same canonicalization that powers snapshot staleness detection).

GitHub Action

# .github/workflows/quantum.yml
on: pull_request
permissions:
  contents: read
  pull-requests: write
jobs:
  quantum:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: XTanishkX/quantum/action@main
        with:
          path: .
          seed: "42"

Every PR gets one sticky comment (updated in place) with pass/fail per check and the hardware cost table โ€” see a live one on PR #1.

Assertions

Assertion What it tests
assert_distribution(result, expected, tvd_threshold=) TVD against an expected distribution, with sampling-floor soundness check
assert_chi_squared(result, expected, alpha=) Pearson goodness-of-fit
assert_fidelity(result, expected, min_fidelity=) Hellinger (classical) fidelity
assert_probability(result, outcome, min_p=, max_p=) Single-outcome probability bounds
assert_matches_baseline(result, counts, alpha=) Two-sample test vs a recorded run

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qontinuum-0.2.0.tar.gz (128.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qontinuum-0.2.0-py3-none-any.whl (108.5 kB view details)

Uploaded Python 3

File details

Details for the file qontinuum-0.2.0.tar.gz.

File metadata

  • Download URL: qontinuum-0.2.0.tar.gz
  • Upload date:
  • Size: 128.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qontinuum-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a68493fb0e3f5002e183d3e5d4b83f8492d132a5352c8f0b2c58cd67435838d
MD5 3afce9b62f2736c25b0e4cfd4ae46c38
BLAKE2b-256 cfda9088758b9406d0fbfb0ca7d2646263f5001a44cdfa9f83a9c9f5cf1c4f9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for qontinuum-0.2.0.tar.gz:

Publisher: release.yml on XTanishkX/quantum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qontinuum-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: qontinuum-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 108.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for qontinuum-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7e73ee8cf50cd6a3e8742ebb6a6c0ab344e33f266e8b2ea28157f9be2b3498b
MD5 d532bfa89865f42c62e9eec9835b4199
BLAKE2b-256 a5725464774e7a7b88e197eb66b77534caf099a9a432174a4ec76478686f7b20

See more details on using hashes here.

Provenance

The following attestation bundles were made for qontinuum-0.2.0-py3-none-any.whl:

Publisher: release.yml on XTanishkX/quantum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page