Commit 1aa1a5a
Execute the example notebook in CI (#7)
* Execute the example notebook in CI
python/examples/run_sqd_sbd.ipynb drives this package from qiskit-addon-sqd's
configuration recovery loop, which nothing else in the suite covers: the reference
energy tests call tpb_diag_from_files directly. Running the notebook checks that the
example still works against the current code, and that the integration it documents
has not drifted.
Follows the extras layout in qiskit-addon-utils: a `basetest` extra holds what every
test environment needs, `nbtest` adds the harness, and `notebook-dependencies` names
what the notebooks themselves import. The last two are separate because pyscf and
qiskit-addon-sqd are needed only to run the examples, not to use sbd.
The tox environment is factored as py{...}-notebook so a specific interpreter can be
selected, matching the sibling repos. CI runs `tox -e py,notebook,mpi` in one
invocation, which keeps the extension compiled once and installed into all three:
verified from a clean .tox as one build_wheel and three install_package, 70 seconds
for the set.
Note that qiskit-addon-sqd is bounded at 0.13.1 rather than 0.13, since the 0.13.0
that a minimum-version pin would resolve to was never released.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Apply suggestion from @garrison
* Spell out the notebook environment names
The section name I wrote, {,py-,py3-,py310-,...}notebook, does not define the
environments it appears to. tox expands numeric ranges in a section name before
splitting it on braces, so `py314-` parses as `py3` plus the open-ended range `14-`.
The name expanded to 18 environments, 15 of them junk -- py3notebook, 4notebook
through 14notebook, pynotebook -- and none of them py310-notebook through
py314-notebook.
Those five were still in envlist, so `tox` created them from the generic [testenv]:
`tox config -e py312-notebook` reported `commands = pytest`, meaning a bare `tox` ran
the unit suite five extra times and never executed a notebook. Only the explicit
`tox -e notebook` did, which is why CI passed.
Fixed by spelling the names out with the hyphen outside the braces, as in
Qiskit/qiskit-addon-utils#214, which found and explained this. `tox l` now lists no
junk, and all of notebook, py310-notebook through py314-notebook resolve to the nbmake
command; py312-notebook runs the notebook in 22 s.
The py- and py3- variants are dropped, since they resolved to the same interpreter as
the bare notebook environment and added nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 1c42a7a commit 1aa1a5a
3 files changed
Lines changed: 35 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
51 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
52 | 52 | | |
53 | | - | |
54 | | - | |
| 53 | + | |
| 54 | + | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
38 | 49 | | |
39 | 50 | | |
40 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
55 | 71 | | |
56 | 72 | | |
57 | 73 | | |
| |||
0 commit comments