Skip to content

feat!: Reorganize tket::passes and add hugr_passes re-exports#1472

Merged
aborgna-q merged 2 commits intomainfrom
ab/reorganize-passes
Mar 26, 2026
Merged

feat!: Reorganize tket::passes and add hugr_passes re-exports#1472
aborgna-q merged 2 commits intomainfrom
ab/reorganize-passes

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

Followup to #1469.

Does some slight organization of the tket::passes submodules;

  • Moves chunks and unpack_container under tket::passes::util.
  • Moves ModifierResolverPass from tket::modifier::pass to tket::passes.

And adds re-exports for the hugr_passes definitions here.
In the future we may move their implementation to this crate, and deprecate the hugr_passes crate altogether.

BREAKING CHANGE: Moved tket::passes::{chunks, unpack_container} to tket::passes::utils.
BREAKING CHANGE: Moved tket::modifier::ModifierResolverPass to tket::passes.

@aborgna-q aborgna-q requested a review from a team as a code owner March 25, 2026 16:35
@aborgna-q aborgna-q requested review from cqc-alec and doug-q and removed request for doug-q March 25, 2026 16:35
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.61%. Comparing base (be8a63b) to head (dce0f04).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tket/src/passes/guppy.rs 0.00% 1 Missing ⚠️
tket/src/passes/modifier_resolver.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1472      +/-   ##
==========================================
+ Coverage   83.27%   83.61%   +0.34%     
==========================================
  Files         185      187       +2     
  Lines       28038    28791     +753     
  Branches    27047    27800     +753     
==========================================
+ Hits        23350    24075     +725     
- Misses       3534     3553      +19     
- Partials     1154     1163       +9     
Flag Coverage Δ
python 93.00% <ø> (ø)
qis-compiler 91.66% <ø> (ø)
rust 83.28% <33.33%> (+0.36%) ⬆️

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.

@hugrbot
Copy link
Copy Markdown
Collaborator

hugrbot commented Mar 25, 2026

This PR contains breaking changes to the public Rust API.

cargo-semver-checks summary
    Building hugr-passes v0.26.1 (current)
     Built [  30.404s] (current)
   Parsing hugr-passes v0.26.1 (current)
    Parsed [   0.033s] (current)
  Building hugr-passes v0.26.1 (baseline)
     Built [  29.494s] (baseline)
   Parsing hugr-passes v0.26.1 (baseline)
    Parsed [   0.032s] (baseline)
  Checking hugr-passes v0.26.1 -> v0.26.1 (assume minor change)
   Checked [   0.038s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  62.326s] hugr-passes
  Building tket v0.17.0 (current)
     Built [  44.968s] (current)
   Parsing tket v0.17.0 (current)
    Parsed [   0.078s] (current)
  Building tket v0.17.0 (baseline)
     Built [  45.356s] (baseline)
   Parsing tket v0.17.0 (baseline)
    Parsed [   0.099s] (baseline)
  Checking tket v0.17.0 -> v0.17.0 (assume minor change)
   Checked [   0.105s] 196 checks: 191 pass, 5 fail, 0 warn, 56 skip

--- failure enum_missing: pub enum removed or renamed ---

Description:
A publicly-visible enum cannot be imported by its prior path. A `pub use` may have been removed, or the enum itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/enum_missing.ron

Failed in:
enum tket::passes::PullForwardError, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/commutation.rs:189

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/function_missing.ron

Failed in:
function tket::passes::unpack_container::type_unpack::is_opt_of, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:11
function tket::passes::unpack_container::type_unpack::array_args, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:21
function tket::passes::unpack_container::type_unpack::is_array_of, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:152

--- failure module_missing: pub module removed or renamed ---

Description:
A publicly-visible module cannot be imported by its prior path. A `pub use` may have been removed, or the module may have been renamed, removed, or made non-public.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/module_missing.ron

Failed in:
mod tket::passes::unpack_container::type_unpack, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:1
mod tket::passes::unpack_container, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container.rs:1
mod tket::passes::chunks, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/chunks.rs:1
mod tket::passes::unpack_container::op_function_map, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/op_function_map.rs:1

--- failure pub_module_level_const_missing: pub module-level const is missing ---

Description:
A public const is missing or renamed
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/pub_module_level_const_missing.ron

Failed in:
TEMP_UNPACK_EXT_NAME in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container.rs:75

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.47.0/src/lints/struct_missing.ron

Failed in:
struct tket::passes::chunks::ChunkConnection, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/chunks.rs:35
struct tket::modifier::ModifierResolverPass, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/modifier/pass.rs:13
struct tket::passes::unpack_container::type_unpack::TypeUnpacker, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:40
struct tket::passes::unpack_container::TypeUnpacker, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/type_unpack.rs:40
struct tket::passes::unpack_container::op_function_map::OpFunctionMap, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/op_function_map.rs:41
struct tket::passes::unpack_container::OpFunctionMap, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container/op_function_map.rs:41
struct tket::passes::chunks::Chunk, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/chunks.rs:39
struct tket::passes::unpack_container::UnpackContainerBuilder, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/unpack_container.rs:158
struct tket::passes::chunks::CircuitChunks, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/chunks.rs:237
struct tket::passes::CircuitChunks, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/passes/chunks.rs:237

   Summary semver requires new major version: 5 major and 0 minor checks failed
  Finished [  93.902s] tket
  Building tket-qec v0.1.0 (current)
     Built [  45.740s] (current)
   Parsing tket-qec v0.1.0 (current)
    Parsed [   0.006s] (current)
  Building tket-qec v0.1.0 (baseline)
     Built [  45.216s] (baseline)
   Parsing tket-qec v0.1.0 (baseline)
    Parsed [   0.006s] (baseline)
  Checking tket-qec v0.1.0 -> v0.1.0 (assume minor change)
   Checked [   0.014s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [  93.563s] tket-qec
  Building tket-qsystem v0.23.0 (current)
     Built [  50.603s] (current)
   Parsing tket-qsystem v0.23.0 (current)
    Parsed [   0.026s] (current)
  Building tket-qsystem v0.23.0 (baseline)
     Built [  51.262s] (baseline)
   Parsing tket-qsystem v0.23.0 (baseline)
    Parsed [   0.025s] (baseline)
  Checking tket-qsystem v0.23.0 -> v0.23.0 (assume minor change)
   Checked [   0.060s] 196 checks: 196 pass, 56 skip
   Summary no semver update required
  Finished [ 104.067s] tket-qsystem

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like this code is moved from tket/src/passes/borrow_squash.rs, but you didn't remove the old file?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ah, it was a leftover from trying to put the passes into categorical submodules.
I went back to the original flat structure since that would have been too restrictive and hard to change.

I deleted the file, it wasn't being compiled.

Comment thread tket/src/passes/_classical.rs Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are we removing this code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These have been dead code (not compiled) for a while.
We left them there just in case we wanted to use the code again, but now it doesn't seem likely.

Comment thread tket/src/passes/_squash.rs Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are we removing this code?

@aborgna-q aborgna-q requested a review from cqc-alec March 26, 2026 10:08
@aborgna-q aborgna-q added this pull request to the merge queue Mar 26, 2026
Merged via the queue into main with commit b3bc669 Mar 26, 2026
23 of 24 checks passed
@aborgna-q aborgna-q deleted the ab/reorganize-passes branch March 26, 2026 10:31
This was referenced Mar 25, 2026
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.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.

3 participants