qontinuum 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qontinuum-0.1.0/.github/workflows/ci.yml +30 -0
- qontinuum-0.1.0/.github/workflows/qontinuum.yml +19 -0
- qontinuum-0.1.0/.github/workflows/release.yml +32 -0
- qontinuum-0.1.0/.gitignore +22 -0
- qontinuum-0.1.0/CONTRIBUTING.md +47 -0
- qontinuum-0.1.0/LICENSE +202 -0
- qontinuum-0.1.0/PKG-INFO +230 -0
- qontinuum-0.1.0/README.md +190 -0
- qontinuum-0.1.0/action/action.yml +83 -0
- qontinuum-0.1.0/docs/backends.md +44 -0
- qontinuum-0.1.0/docs/cost-models.md +44 -0
- qontinuum-0.1.0/docs/launch-notes.md +44 -0
- qontinuum-0.1.0/docs/statistics.md +64 -0
- qontinuum-0.1.0/examples/.qontinuum/snapshots.json +27 -0
- qontinuum-0.1.0/examples/bell/q_test_bell.py +25 -0
- qontinuum-0.1.0/examples/ghz/q_test_ghz.py +20 -0
- qontinuum-0.1.0/examples/grover/q_test_grover.py +28 -0
- qontinuum-0.1.0/examples/noisy/q_test_noisy_bell.py +24 -0
- qontinuum-0.1.0/examples/vqe/q_test_vqe_ansatz.py +38 -0
- qontinuum-0.1.0/pyproject.toml +76 -0
- qontinuum-0.1.0/src/qontinuum/__init__.py +31 -0
- qontinuum-0.1.0/src/qontinuum/assertions/__init__.py +21 -0
- qontinuum-0.1.0/src/qontinuum/assertions/asserts.py +165 -0
- qontinuum-0.1.0/src/qontinuum/assertions/context.py +43 -0
- qontinuum-0.1.0/src/qontinuum/assertions/stats.py +137 -0
- qontinuum-0.1.0/src/qontinuum/circuits/__init__.py +15 -0
- qontinuum-0.1.0/src/qontinuum/circuits/diff.py +75 -0
- qontinuum-0.1.0/src/qontinuum/circuits/hashing.py +72 -0
- qontinuum-0.1.0/src/qontinuum/circuits/loader.py +98 -0
- qontinuum-0.1.0/src/qontinuum/cli.py +392 -0
- qontinuum-0.1.0/src/qontinuum/cost/__init__.py +18 -0
- qontinuum-0.1.0/src/qontinuum/cost/analysis.py +57 -0
- qontinuum-0.1.0/src/qontinuum/cost/catalog.yaml +137 -0
- qontinuum-0.1.0/src/qontinuum/cost/estimator.py +134 -0
- qontinuum-0.1.0/src/qontinuum/hardware/__init__.py +18 -0
- qontinuum-0.1.0/src/qontinuum/hardware/base.py +47 -0
- qontinuum-0.1.0/src/qontinuum/hardware/braket.py +57 -0
- qontinuum-0.1.0/src/qontinuum/hardware/ibm.py +44 -0
- qontinuum-0.1.0/src/qontinuum/hardware/runner.py +110 -0
- qontinuum-0.1.0/src/qontinuum/noise/__init__.py +5 -0
- qontinuum-0.1.0/src/qontinuum/noise/ibm.py +88 -0
- qontinuum-0.1.0/src/qontinuum/report/__init__.py +5 -0
- qontinuum-0.1.0/src/qontinuum/report/dashboard.py +190 -0
- qontinuum-0.1.0/src/qontinuum/report/history.py +96 -0
- qontinuum-0.1.0/src/qontinuum/report/markdown.py +86 -0
- qontinuum-0.1.0/src/qontinuum/report/schema.py +63 -0
- qontinuum-0.1.0/src/qontinuum/router/__init__.py +17 -0
- qontinuum-0.1.0/src/qontinuum/router/score.py +108 -0
- qontinuum-0.1.0/src/qontinuum/runner/__init__.py +8 -0
- qontinuum-0.1.0/src/qontinuum/runner/backends.py +59 -0
- qontinuum-0.1.0/src/qontinuum/runner/discovery.py +65 -0
- qontinuum-0.1.0/src/qontinuum/runner/engine.py +158 -0
- qontinuum-0.1.0/src/qontinuum/runner/qtest.py +78 -0
- qontinuum-0.1.0/src/qontinuum/runner/result.py +27 -0
- qontinuum-0.1.0/src/qontinuum/runner/snapshots.py +45 -0
- qontinuum-0.1.0/tests/test_assertion_context.py +62 -0
- qontinuum-0.1.0/tests/test_assertions.py +151 -0
- qontinuum-0.1.0/tests/test_circuits.py +129 -0
- qontinuum-0.1.0/tests/test_cost.py +118 -0
- qontinuum-0.1.0/tests/test_diff.py +106 -0
- qontinuum-0.1.0/tests/test_hardware.py +139 -0
- qontinuum-0.1.0/tests/test_history_dashboard.py +135 -0
- qontinuum-0.1.0/tests/test_interop.py +72 -0
- qontinuum-0.1.0/tests/test_noise.py +82 -0
- qontinuum-0.1.0/tests/test_report.py +118 -0
- qontinuum-0.1.0/tests/test_router.py +99 -0
- qontinuum-0.1.0/tests/test_runner.py +203 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- run: pip install ruff
|
|
17
|
+
- run: ruff check .
|
|
18
|
+
|
|
19
|
+
test:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
strategy:
|
|
22
|
+
matrix:
|
|
23
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
- run: pip install -e ".[dev,ibm]" cirq-core pennylane
|
|
30
|
+
- run: pytest
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: Qontinuum (dogfood)
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
|
|
6
|
+
permissions:
|
|
7
|
+
contents: read
|
|
8
|
+
pull-requests: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
quantum-tests:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: ./action
|
|
16
|
+
with:
|
|
17
|
+
path: examples
|
|
18
|
+
seed: "42"
|
|
19
|
+
install: ".[ibm]"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- uses: actions/setup-python@v5
|
|
13
|
+
with:
|
|
14
|
+
python-version: "3.12"
|
|
15
|
+
- run: pip install build && python -m build
|
|
16
|
+
- uses: actions/upload-artifact@v4
|
|
17
|
+
with:
|
|
18
|
+
name: dist
|
|
19
|
+
path: dist/
|
|
20
|
+
|
|
21
|
+
publish:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
environment: pypi
|
|
25
|
+
permissions:
|
|
26
|
+
id-token: write # PyPI trusted publishing
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/download-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: dist
|
|
31
|
+
path: dist/
|
|
32
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.venv/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.coverage
|
|
11
|
+
htmlcov/
|
|
12
|
+
|
|
13
|
+
# OS / editors
|
|
14
|
+
.DS_Store
|
|
15
|
+
.idea/
|
|
16
|
+
.vscode/
|
|
17
|
+
|
|
18
|
+
# Qontinuum local artifacts (snapshots.json IS committed; these are not)
|
|
19
|
+
**/.qontinuum/cache/
|
|
20
|
+
**/.qontinuum/history.jsonl
|
|
21
|
+
qontinuum-report.md
|
|
22
|
+
qontinuum-dashboard.html
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Contributing to Qontinuum
|
|
2
|
+
|
|
3
|
+
## Development setup
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
git clone https://github.com/XTanishkX/quantum
|
|
7
|
+
cd quantum
|
|
8
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
9
|
+
pip install -e ".[dev,ibm]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Checks
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
ruff check . # lint
|
|
16
|
+
pytest # unit + integration tests
|
|
17
|
+
qont test examples # dogfood the CLI
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Both run in CI on every PR, along with the Qontinuum action itself running
|
|
21
|
+
against `examples/` (we eat our own cooking — quantum tests + cost comment).
|
|
22
|
+
|
|
23
|
+
## Project layout
|
|
24
|
+
|
|
25
|
+
| Path | What lives there |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `src/qontinuum/circuits` | QASM/Qiskit/Cirq/PennyLane loading, canonical form, hashing, semantic diff |
|
|
28
|
+
| `src/qontinuum/assertions` | statistics (`stats.py`), user-facing asserts, statistic capture context |
|
|
29
|
+
| `src/qontinuum/runner` | `@qtest`, discovery, backends, engine, snapshots |
|
|
30
|
+
| `src/qontinuum/noise` | Aer noise models from IBM calibration data |
|
|
31
|
+
| `src/qontinuum/cost` | pricing catalog (`catalog.yaml`), circuit profiling, estimator |
|
|
32
|
+
| `src/qontinuum/router` | device scoring: success probability × cost, ranking strategies |
|
|
33
|
+
| `src/qontinuum/hardware` | real-QPU adapters (IBM, Braket) behind the all-or-nothing spend guard |
|
|
34
|
+
| `src/qontinuum/report` | versioned JSON schema, markdown renderer, run history, HTML dashboard |
|
|
35
|
+
| `action/` | the composite GitHub Action |
|
|
36
|
+
|
|
37
|
+
## Design rules
|
|
38
|
+
|
|
39
|
+
- **The result JSON schema is a contract.** Anything that changes its shape bumps
|
|
40
|
+
`SCHEMA_VERSION` in `report/schema.py`.
|
|
41
|
+
- **Pricing lives in data, not code.** New devices/providers are added to
|
|
42
|
+
`cost/catalog.yaml` with a source URL and verified date; the estimator only knows
|
|
43
|
+
pricing *models* (`per_shot`, `per_second`, `gate_shot`, `hqc`).
|
|
44
|
+
- **Assertions must be shots-aware.** Any new statistical assertion needs a soundness
|
|
45
|
+
guard: it must refuse configurations that would be flaky by construction.
|
|
46
|
+
- **Offline by default.** Tests and CI must run without accounts or network; anything
|
|
47
|
+
live (e.g. `@live` calibration) is opt-in.
|
qontinuum-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
qontinuum-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qontinuum
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CI/CD, noise-aware regression testing, and cost intelligence for quantum programs
|
|
5
|
+
Project-URL: Homepage, https://github.com/XTanishkX/quantum
|
|
6
|
+
Project-URL: Issues, https://github.com/XTanishkX/quantum/issues
|
|
7
|
+
Author: Tanish Arora
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ci,cost-estimation,devops,qiskit,quantum,quantum-computing,testing
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Classifier: Topic :: Software Development :: Testing
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: numpy>=1.26
|
|
22
|
+
Requires-Dist: pydantic>=2.6
|
|
23
|
+
Requires-Dist: pyyaml>=6.0
|
|
24
|
+
Requires-Dist: qiskit-aer>=0.15
|
|
25
|
+
Requires-Dist: qiskit-qasm3-import>=0.5
|
|
26
|
+
Requires-Dist: qiskit>=1.3
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Requires-Dist: scipy>=1.11
|
|
29
|
+
Requires-Dist: typer>=0.12
|
|
30
|
+
Provides-Extra: braket
|
|
31
|
+
Requires-Dist: amazon-braket-sdk>=1.80; extra == 'braket'
|
|
32
|
+
Requires-Dist: qiskit-braket-provider>=0.4; extra == 'braket'
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
37
|
+
Provides-Extra: ibm
|
|
38
|
+
Requires-Dist: qiskit-ibm-runtime>=0.30; extra == 'ibm'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# Qontinuum
|
|
42
|
+
|
|
43
|
+
**CI/CD, noise-aware regression testing, and cost intelligence for quantum programs.**
|
|
44
|
+
|
|
45
|
+
Quantum programs don't return values — they return probability distributions sampled from
|
|
46
|
+
noisy hardware. `assert result == expected` doesn't work, and nothing in the classical CI
|
|
47
|
+
toolchain knows that. Qontinuum does.
|
|
48
|
+
|
|
49
|
+
- **`qont test`** — a pytest-style runner for quantum circuits with *statistical* assertions:
|
|
50
|
+
total variation distance with shots-aware soundness floors, chi-squared tests, Hellinger
|
|
51
|
+
fidelity, and snapshot baselines committed as JSON.
|
|
52
|
+
- **`qont cost`** — estimates what your suite would cost on real hardware across providers
|
|
53
|
+
(IonQ, Rigetti, IQM, AQT via Braket; IBM; Azure Quantum) before you spend a cent.
|
|
54
|
+
- **`qont route`** — recommends hardware for your workload: estimated success probability ×
|
|
55
|
+
price, ranked by `--optimize cost|fidelity|value`.
|
|
56
|
+
- **`qont run --on ibm:… --max-cost 5`** — executes the suite on *real* hardware behind an
|
|
57
|
+
all-or-nothing spend guard (default budget: $0 — it refuses until you authorize).
|
|
58
|
+
- **`qont ci`** — one command for CI: run the suite, write a markdown report.
|
|
59
|
+
- **`qont dashboard`** — renders run history as a self-contained HTML observability
|
|
60
|
+
dashboard (status timeline, per-check statistic trends vs thresholds).
|
|
61
|
+
- **`qont diff` / `qont hash`** — semantic, register-name-agnostic circuit diffing and
|
|
62
|
+
content addressing.
|
|
63
|
+
- **GitHub Action** — posts a sticky PR comment with regression results and the cost table.
|
|
64
|
+
- **Noise-aware testing** — simulate against real IBM device calibration data, offline,
|
|
65
|
+
for free.
|
|
66
|
+
- **Bring your own SDK** — `load_circuit` also accepts Cirq circuits and PennyLane tapes.
|
|
67
|
+
|
|
68
|
+
> Status: pre-release (v0.1 in development).
|
|
69
|
+
|
|
70
|
+
## Install
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
pip install qontinuum # core
|
|
74
|
+
pip install 'qontinuum[ibm]' # + IBM calibration noise models
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Quick start
|
|
78
|
+
|
|
79
|
+
Write a quantum test in any file named `q_test_*.py`:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from qiskit import QuantumCircuit
|
|
83
|
+
from qontinuum import qtest, assert_distribution
|
|
84
|
+
|
|
85
|
+
@qtest(shots=4000)
|
|
86
|
+
def bell_pair():
|
|
87
|
+
qc = QuantumCircuit(2)
|
|
88
|
+
qc.h(0)
|
|
89
|
+
qc.cx(0, 1)
|
|
90
|
+
qc.measure_all()
|
|
91
|
+
return qc
|
|
92
|
+
|
|
93
|
+
@bell_pair.check
|
|
94
|
+
def is_maximally_entangled(result):
|
|
95
|
+
assert_distribution(result, {"00": 0.5, "11": 0.5}, tvd_threshold=0.05)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
$ qont test
|
|
100
|
+
✓ q_test_bell.py::bell_pair aer, 4000 shots, 30 ms
|
|
101
|
+
✓ is_maximally_entangled
|
|
102
|
+
|
|
103
|
+
1 passed, 0 failed, 0 errors
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Statistics done right
|
|
107
|
+
|
|
108
|
+
Sampling noise means even a perfect circuit never reproduces a distribution exactly.
|
|
109
|
+
Every assertion is shots-aware: if your threshold is below what the shot count can
|
|
110
|
+
statistically resolve, Qontinuum refuses to run a test that would be flaky by
|
|
111
|
+
construction — and tells you the shot count that would fix it:
|
|
112
|
+
|
|
113
|
+
```text
|
|
114
|
+
! is_maximally_entangled tvd_threshold=0.01 is below the sampling noise floor 0.0289
|
|
115
|
+
at 4000 shots: even a perfect result would fail ~1% of the time.
|
|
116
|
+
Use at least 33380 shots or raise the threshold to >= 0.0289.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Test against real hardware noise — offline and free
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
@qtest(shots=4000, backend="ibm:manila") # bundled real calibration snapshot
|
|
123
|
+
def bell_under_noise(): ...
|
|
124
|
+
|
|
125
|
+
@qtest(shots=4000, backend="ibm:brisbane@live") # today's live calibration (free IBM account)
|
|
126
|
+
def bell_today(): ...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Snapshot testing for quantum
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
@qtest(shots=4000, snapshot=True)
|
|
133
|
+
def ghz_5(): ...
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`qont snapshot update` records the distribution as a golden baseline (keyed by the
|
|
137
|
+
circuit's content hash). Later runs are compared with a two-sample homogeneity test —
|
|
138
|
+
if the circuit changes, the snapshot is flagged stale for review, exactly like Jest.
|
|
139
|
+
|
|
140
|
+
### Know the cost before you run on hardware
|
|
141
|
+
|
|
142
|
+
```text
|
|
143
|
+
$ qont cost
|
|
144
|
+
Estimated hardware cost — 3 test(s), 12000 total shots
|
|
145
|
+
┃ Provider ┃ Device ┃ Est. cost ┃
|
|
146
|
+
│ AWS Braket │ Rigetti Cepheus │ $6.00 │
|
|
147
|
+
│ IBM Quantum │ Heron (Pay-As-You-Go) │ $9.61 │
|
|
148
|
+
│ AWS Braket │ IQM Garnet │ $18.30 │
|
|
149
|
+
│ Azure Quantum │ IonQ Aria 1 │ $63.29 │
|
|
150
|
+
│ AWS Braket │ IonQ Forte │ $960.90 │
|
|
151
|
+
│ Azure Quantum │ Quantinuum H2 │ 137.4 HQC │
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Same suite, **$6 or $961**, depending on where you run it. That's why this table
|
|
155
|
+
belongs on every pull request.
|
|
156
|
+
|
|
157
|
+
### Route to the right hardware
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
$ qont route --optimize value
|
|
161
|
+
┃ # ┃ Provider ┃ Device ┃ Est. success/shot ┃ Est. cost ┃ $ / success ┃
|
|
162
|
+
│ 1 │ AWS Braket │ Rigetti Cepheus │ 71.0% │ $10.00 │ $14.08 │
|
|
163
|
+
│ 2 │ IBM Quantum │ Heron (PAYG) │ 93.3% │ $16.01 │ $17.17 │
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Cheap-but-noisy vs pricey-but-clean, resolved with one number.
|
|
167
|
+
|
|
168
|
+
### Run on real hardware — without surprise bills
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
qont run --on ibm:ibm_brisbane --dry-run --max-cost 5 # estimate only
|
|
172
|
+
qont run --on braket:rigetti_cepheus --max-cost 5 # refuses if estimate > $5
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The guard is all-or-nothing: the whole suite is priced *before* the first shot is
|
|
176
|
+
submitted, and the default budget is $0.
|
|
177
|
+
|
|
178
|
+
### Watch your suite over time
|
|
179
|
+
|
|
180
|
+
Every run appends to `.qontinuum/history.jsonl`; `qont dashboard` turns it into a
|
|
181
|
+
single-file HTML dashboard — status timeline, each check's statistic trending against
|
|
182
|
+
its threshold, cost per run. No server, no JavaScript, works as a CI artifact.
|
|
183
|
+
|
|
184
|
+
### Diff circuits, not files
|
|
185
|
+
|
|
186
|
+
```text
|
|
187
|
+
$ qont diff old.qasm new.qasm
|
|
188
|
+
- cx q[0, 1]
|
|
189
|
+
+ cx q[1, 0]
|
|
190
|
+
1 ops added, 1 removed
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Register renames and formatting don't show up — only semantic changes do (the same
|
|
194
|
+
canonicalization that powers snapshot staleness detection).
|
|
195
|
+
|
|
196
|
+
## GitHub Action
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
# .github/workflows/quantum.yml
|
|
200
|
+
on: pull_request
|
|
201
|
+
permissions:
|
|
202
|
+
contents: read
|
|
203
|
+
pull-requests: write
|
|
204
|
+
jobs:
|
|
205
|
+
quantum:
|
|
206
|
+
runs-on: ubuntu-latest
|
|
207
|
+
steps:
|
|
208
|
+
- uses: actions/checkout@v4
|
|
209
|
+
- uses: XTanishkX/quantum/action@main
|
|
210
|
+
with:
|
|
211
|
+
path: .
|
|
212
|
+
seed: "42"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Every PR gets one sticky comment (updated in place) with pass/fail per check and the
|
|
216
|
+
hardware cost table.
|
|
217
|
+
|
|
218
|
+
## Assertions
|
|
219
|
+
|
|
220
|
+
| Assertion | What it tests |
|
|
221
|
+
|---|---|
|
|
222
|
+
| `assert_distribution(result, expected, tvd_threshold=)` | TVD against an expected distribution, with sampling-floor soundness check |
|
|
223
|
+
| `assert_chi_squared(result, expected, alpha=)` | Pearson goodness-of-fit |
|
|
224
|
+
| `assert_fidelity(result, expected, min_fidelity=)` | Hellinger (classical) fidelity |
|
|
225
|
+
| `assert_probability(result, outcome, min_p=, max_p=)` | Single-outcome probability bounds |
|
|
226
|
+
| `assert_matches_baseline(result, counts, alpha=)` | Two-sample test vs a recorded run |
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
Apache-2.0
|