Skip to content

Fix Qiskit stage plugins and release 0.1.2 - #1

Merged
VesterlundCoder merged 1 commit into
mainfrom
release-review-2026-10
Oct 27, 2026
Merged

VesterlundCoder merged 1 commit into
mainfrom
release-review-2026-10

Conversation

@VesterlundCoder

Copy link
Copy Markdown
Contributor

Summary

Fixes the P0 "Qiskit stage plugin" finding from the 2026-10-24 release review and prepares westquant-qiskit 0.1.2.

The plugin was broken, not only a no-op. On Qiskit 2.5.2 and 2.6.1, generate_preset_pass_manager(layout_method="westquant") or routing_method="westquant" raised TypeError: 'DAGCircuit' object is not iterable from QuantumCircuit.from_instructions(dag). The candidate path also read the private tqc._layout.dag and swallowed every exception.

  • stage.py rewritten. Each stage is a deterministic best-of over Qiskit's own strategies, scored by two-qubit cost (SWAP = 3) and then depth:
    • layout: trivial/dense/sabre, each scored by a full transpile; sets property_set["layout"], then Qiskit's standard embed passes.
    • routing: SabreSwap/BasicSwap/LookaheadSwap on the physical DAG; keeps the routed DAG and composes final_layout; wrapped in common.generate_routing_passmanager, so it only runs when the circuit is not already mapped.
    • optimization: Qiskit's default optimization stage for levels 0-3.
  • Every candidate, including failures with their error, is recorded in property_set["westquant_selection"] and failures are logged. If every candidate fails, a TranspilerError is raised.
  • optimization_level=0 is no longer replaced by 2.
  • Source/PyPI drift fixed: the published 0.1.1 wheel contains BackendV2 Target support in adapter.noise_aware_metrics that was never committed. It is now in git, with a GenericBackendV2 test. Without this, the next release would have removed that feature.
  • CI: visible nightly failures, single gated publish path (same as the other SDK repos), tests matrix over Qiskit 2.5.2 and 2.6.1.
  • Version 0.1.2. The review proposed 0.1.0a5, but 0.1.0a5 and 0.1.1 already exist on PyPI. pip would also never pick a pre-release over 0.1.1.

Test plan

  • New tests/test_stage.py (13 tests): 10 fail against the old stage.py, all pass now
  • test_noise_aware_metrics_backend_v2_target fails without the ported adapter, passes with it
  • Full suite: 24 passed on Python 3.12 + Qiskit 2.6.1 and Python 3.10 + Qiskit 2.5.2
  • wheel + sdist built, twine check --strict passes, both installed in clean venvs with pip check, suite passes against the installed package
  • Tests workflow green on this PR

Generated with Devin

The westquant layout/routing/optimization stage plugins crashed on Qiskit 2.x
(QuantumCircuit.from_instructions(dag) on a DAGCircuit) and the candidate
path relied on the private tqc._layout.dag. Failed candidates were swallowed.

- Reimplement each stage as a deterministic best-of over Qiskit built-ins that
  sets layout/final_layout correctly and reuses Qiskit's embed and routing
  stage wrappers; record every candidate in property_set and raise when all
  candidates fail.
- Add end-to-end tests: discovery, unitary equivalence, measurement
  distribution, coupling-map compliance, applied candidate, all-fail error.
- Bring the BackendV2 Target support that shipped in the 0.1.1 wheel but was
  never committed into the source tree, with a test.
- CI: visible nightly failures, single gated publish path, Qiskit 2.5.2 and
  2.6.1 test matrix. Version 0.1.2 (0.1.0a5 and 0.1.1 are already on PyPI).

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@VesterlundCoder
VesterlundCoder merged commit d14c7ab into main Oct 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant