Skip to content

feat: Pass scopes in python API, update to hugr-py 0.16#1464

Merged
CalMacCQ merged 18 commits intomainfrom
ab/pass-scopes-py
Apr 2, 2026
Merged

feat: Pass scopes in python API, update to hugr-py 0.16#1464
CalMacCQ merged 18 commits intomainfrom
ab/pass-scopes-py

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

@aborgna-q aborgna-q commented Mar 24, 2026

Work in progress, requires Quantinuum/hugr#2976.

Closes #1450

EDIT: (Callum) closes #1493 see 1cd6ad3

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.81%. Comparing base (cc5ca5c) to head (6f8fa30).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket-py/tket/passes.py 75.00% 3 Missing ⚠️
tket/src/serialize/pytket/circuit.rs 89.47% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1464      +/-   ##
==========================================
+ Coverage   83.80%   83.81%   +0.01%     
==========================================
  Files         187      187              
  Lines       28923    28943      +20     
  Branches    27865    27880      +15     
==========================================
+ Hits        24238    24258      +20     
  Misses       3523     3523              
  Partials     1162     1162              
Flag Coverage Δ
python 92.41% <76.92%> (+0.03%) ⬆️
qis-compiler 91.66% <100.00%> (ø)
rust 83.48% <89.47%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tket-py/tket/passes.py
Comment thread tket-py/tket/passes.py Outdated
Comment thread tket-py/src/passes/tket1.rs Outdated
@CalMacCQ CalMacCQ marked this pull request as ready for review March 31, 2026 16:43
@CalMacCQ CalMacCQ requested a review from a team as a code owner March 31, 2026 16:43
@CalMacCQ CalMacCQ requested review from doug-q and removed request for doug-q March 31, 2026 16:43
@CalMacCQ CalMacCQ changed the title feat: Pass scopes in python API feat: Pass scopes in python API, update to hugr 0.16 Apr 1, 2026
@CalMacCQ CalMacCQ requested a review from cqc-alec April 1, 2026 15:56
Comment thread qis-compiler/python/tests/test_basic_generation.py
Comment thread tket-py/src/passes/tket1.rs Outdated
Comment thread tket-py/tket/passes.py Outdated
Comment thread tket-py/tket/passes.py
@CalMacCQ CalMacCQ changed the title feat: Pass scopes in python API, update to hugr 0.16 feat: Pass scopes in python API, update to hugr-py 0.16 Apr 2, 2026
# Assert that FullPeepholeOptimise cancels every CZ and H gate.
assert _count_ops(opt_hugr, "H") == 0
assert _count_ops(opt_hugr, "CZ") == 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I plan to add more extensive testing in a followup PR. Agustin was keen to merge this and then make the tket-rs release.

@cqc-alec
Copy link
Copy Markdown
Collaborator

cqc-alec commented Apr 2, 2026

Do you know why the CI checks are failing?

@aborgna-q
Copy link
Copy Markdown
Collaborator Author

Do you know why the CI checks are failing?

The required check is failing because snapshots need updating.

The python wheels check fails with a "conan not found" error. They are also failing on main, we'll address them with the wheels workflow rework.

@CalMacCQ CalMacCQ added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 369aba2 Apr 2, 2026
26 of 30 checks passed
@CalMacCQ CalMacCQ deleted the ab/pass-scopes-py branch April 2, 2026 12:12
github-merge-queue bot pushed a commit that referenced this pull request Apr 2, 2026
## 🤖 New release

* `tket`: 0.17.0 -> 0.18.0 (✓ API compatible changes)
* `tket-qsystem`: 0.23.0 -> 0.24.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `tket`

<blockquote>

##
[0.18.0](tket-v0.17.0...tket-v0.18.0)
- 2026-04-02

### Bug Fixes

- *(pytket decoder)* Panic on repeated bit registers in pytket decoded
output ([#1445](#1445))
- pytket encoder drops order edges to the output node
([#1466](#1466))

### Documentation

- Fix tket README introductory example
([#1463](#1463))

### New Features

- [**breaking**] Use raw Hugrs in pytket encoding/decoding API
([#1418](#1418))
- [**breaking**] Remove unused `lower_to_pytket` pass
([#1431](#1431))
- [**breaking**] Replace CircuitHash with hugr's implementation
([#1420](#1420))
- [**breaking**] Update MSRV to rust 1.91
([#1446](#1446))
- [**breaking**] Update to hugr 0.26.0
([#1448](#1448))
- [**breaking**] Follow pass scopes in composable passes
([#1429](#1429))
- Implemented `post_opdef` for `RotationOp` for constant folding
([#1468](#1468))
- [**breaking**] Reorganize `tket::passes` and add `hugr_passes`
re-exports ([#1472](#1472))
- [**breaking**] Bump `hugr` dependency to 0.27.0
([#1488](#1488))
- Move hugr-passes implementations to tket::passes
([#1487](#1487))
- Pass scopes in python API, update to hugr-py 0.16
([#1464](#1464))

### Refactor

- *(llvm)* use llvm.is.fpclass for from_halfturns
([#1457](#1457))

### Testing

- Fixed signatures when decoding pytket circuits
([#1405](#1405))
</blockquote>

## `tket-qsystem`

<blockquote>

##
[0.24.0](tket-qsystem-v0.23.0...tket-qsystem-v0.24.0)
- 2026-04-02

### Bug Fixes

- pytket encoder drops order edges to the output node
([#1466](#1466))
- Constant Folding with PassScope::Global should act globally, not just
beneath the entrypoint
([#1470](#1470))

### New Features

- [**breaking**] Use raw Hugrs in pytket encoding/decoding API
([#1418](#1418))
- Add qsystem.rz pytket decoder
([#1432](#1432))
- [**breaking**] Update MSRV to rust 1.91
([#1446](#1446))
- [**breaking**] Update to hugr 0.26.0
([#1448](#1448))
- [**breaking**] Follow pass scopes in composable passes
([#1429](#1429))
- [**breaking**] Reorganize `tket::passes` and add `hugr_passes`
re-exports ([#1472](#1472))
- Move hugr-passes implementations to tket::passes
([#1487](#1487))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Agustín Borgna <[email protected]>
@hugrbot hugrbot mentioned this pull request Apr 7, 2026
github-merge-queue bot pushed a commit that referenced this pull request Apr 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.12.3](tket-exts-v0.12.2...tket-exts-v0.12.3)
(2026-04-07)


### Features

* Pass scopes in python API, update to hugr-py 0.16
([#1464](#1464))
([369aba2](369aba2))


### Documentation

* fix tket-exts pyproject description
([#1436](#1436))
([6f68fe0](6f68fe0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Agustín Borgna <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Apr 7, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.13.0](tket-py-v0.12.16...tket-py-v0.13.0)
(2026-04-07)


### ⚠ BREAKING CHANGES

* Removed `Tk2Circuit` use `CompilationState` instead. Non-stable APIs
have been marked as internal. They will be re-designed and stabilized in
future releases.
* Moved `tket::modifier::ModifierResolverPass` to
* Renamed
* Updated public `hugr` dependency to `0.26.0`.
* Minimum supported Rust version bumped to 1.91
* Removed `CircuitHash` trait, use `Circuit::circuit_hash` or
`hugr::algorithms::hash::HugrHash` instead.
* Removed `tket::passes::lower_to_pytket`. Use `NormalizeGuppy` instead.
* Renamed `TKETDecode::decode_inplace` to `decode_into`.
* Removed deprecated `find_tuple_unpack_rewrites`. Use

### Features

* expose ModifierResolverPass to Python
([#1502](#1502))
([9e3e0de](9e3e0de)),
closes [#1452](#1452)
* Expose NormalizeGuppy::squash_borrows flag in python
([#1412](#1412))
([ba25fa1](ba25fa1))
* Follow pass scopes in composable passes
([#1429](#1429))
([ae0016c](ae0016c))
* Move hugr-passes implementations to tket::passes
([#1487](#1487))
([cc5ca5c](cc5ca5c))
* Pass scopes in python API, update to hugr-py 0.16
([#1464](#1464))
([369aba2](369aba2))
* Print full traceback for rust-originated errors
([#1435](#1435))
([9c03ee0](9c03ee0))
* Remove deprecated unpack tuple pass
([#1387](#1387))
([86ac8f9](86ac8f9))
* Remove unused `lower_to_pytket` pass
([#1431](#1431))
([a214abc](a214abc))
* Reorganize `tket::passes` and add `hugr_passes` re-exports
([#1472](#1472))
([b3bc669](b3bc669))
* Replace `Tk2Circuit` with a simpler `CompilationState` definition
([#1482](#1482))
([e814f35](e814f35))
* Replace CircuitHash with hugr's implementation
([#1420](#1420))
([e2b4991](e2b4991))
* Update MSRV to rust 1.91
([#1446](#1446))
([b82a771](b82a771))
* Update to hugr 0.26.0
([#1448](#1448))
([f43a877](f43a877))
* Use raw Hugrs in pytket encoding/decoding API
([#1418](#1418))
([9df9993](9df9993))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Agustín Borgna <[email protected]>
Co-authored-by: Agustín Borgna <[email protected]>
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.

[Bug]: Selene-qis-compiler test fails with hugr 0.16 [Feature]: Implement PassScopes for Rust backed Python passes

3 participants