Skip to content

feat: Move hugr-passes implementations to tket::passes#1487

Merged
aborgna-q merged 7 commits intomainfrom
ab/drop-hugr-passes
Apr 2, 2026
Merged

feat: Move hugr-passes implementations to tket::passes#1487
aborgna-q merged 7 commits intomainfrom
ab/drop-hugr-passes

Conversation

@aborgna-q
Copy link
Copy Markdown
Collaborator

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

Moves the pass implementations that we brought from hugr in #1414 to tket::passes itself.

This way we don't need to deal with synchronizing crate updates, and remove the hugr-* crate from here.

This PR moves the files from hugr-passes/src/* to tket/src/passes/ to ensure other PRs modifying the code can be safely updated.
I could have copied the files instead, but that would cause problems with PRs updating the old code.

I instead put re-exports in the original crate, along with warnings about the crate deprecation.
I'll make a last breaking release of it after tket 0.18.0, before removing the crate from this repo.

Ended up removing the crate entirely here. We'll make a last deprecated release of hugr-passes, but that will be done from a branch. See #1492

@aborgna-q aborgna-q requested a review from a team as a code owner March 31, 2026 13:58
@aborgna-q aborgna-q requested a review from acl-cqc March 31, 2026 13:58
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 83.01887% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.83%. Comparing base (10ace83) to head (8ed8c1b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket/src/passes/composable.rs 83.33% 31 Missing and 2 partials ⚠️
tket/src/passes/dataflow/test.rs 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1487      +/-   ##
==========================================
+ Coverage   83.66%   83.83%   +0.17%     
==========================================
  Files         187      187              
  Lines       29013    28923      -90     
  Branches    27955    27865      -90     
==========================================
- Hits        24273    24248      -25     
+ Misses       3577     3515      -62     
+ Partials     1163     1160       -3     
Flag Coverage Δ
python 92.37% <ø> (ø)
qis-compiler 91.66% <ø> (ø)
rust 83.51% <83.01%> (+0.17%) ⬆️

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.

@aborgna-q
Copy link
Copy Markdown
Collaborator Author

Ignore the breaking changes reported in hugr-passes.
rs-semver-checks doesn't like it when you move stuff between crates, and we'll make a breaking -passes release anyways.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the pass implementations previously housed in the hugr-passes crate into tket::passes, removing the in-repo hugr-passes crate and updating all dependent crates and CI/workflows accordingly.

Changes:

  • Moved/ported pass implementations (composable framework, dataflow, lowering, inlining, etc.) under tket/src/passes/** and updated re-exports in tket/src/passes.rs.
  • Removed the hugr-passes workspace member/crate and scrubbed dependencies/references across tket-*, qis-compiler, and CI config.
  • Added/relocated supporting test utilities and updated Cargo dependencies/dev-dependencies needed by the moved code.

Reviewed changes

Copilot reviewed 48 out of 63 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tket/src/passes.rs Rebuilds tket::passes module structure/re-exports to host moved implementations
tket/src/passes/composable.rs In-tree composable pass framework (traits, validation wrapper, sequencing)
tket/src/passes/composable/scope.rs Pass scope configuration/types moved into tket::passes
tket/src/passes/const_fold.rs Constant folding pass now sourced from tket::passes
tket/src/passes/const_fold/value_handle.rs Updates dataflow/const-fold glue imports to new module paths
tket/src/passes/const_fold/test.rs Updates tests to new tket::passes paths
tket/src/passes/dataflow.rs Dataflow framework entry module moved into tket::passes
tket/src/passes/dataflow/datalog.rs Ascent-based datalog engine moved into tket::passes
tket/src/passes/dataflow/partial_value.rs Partial lattice/value domain moved into tket::passes (with property tests)
tket/src/passes/dataflow/results.rs Dataflow analysis result wrapper/types moved into tket::passes
tket/src/passes/dataflow/test.rs Updates dataflow tests to new module paths
tket/src/passes/dataflow/value_row.rs Dataflow utility type moved into tket::passes
tket/src/passes/dead_code.rs Updates imports to new composable scope paths
tket/src/passes/dead_funcs.rs Updates imports/tests to new composable scope paths
tket/src/passes/force_order.rs Moves force-order implementation into tket::passes
tket/src/passes/half_node.rs Moves internal CFG helper into tket::passes
tket/src/passes/inline_dfgs.rs Updates imports/tests to tket::passes paths
tket/src/passes/inline_funcs.rs Moves inline-funcs pass and tests into tket::passes
tket/src/passes/lower.rs Moves lowering helpers/errors into tket::passes
tket/src/passes/monomorphize.rs Updates imports/doc links to tket::passes paths
tket/src/passes/non_local.rs Updates imports/tests to tket::passes paths
tket/src/passes/non_local/localize.rs Moves non-local edge localization implementation into tket::passes
tket/src/passes/normalize_cfgs.rs Updates imports/tests and minor assertion tweak
tket/src/passes/redundant_order_edges.rs Updates imports to tket::passes paths
tket/src/passes/replace_types.rs Updates imports/doc links/tests to tket::passes paths
tket/src/passes/replace_types/handlers.rs Updates imports/tests to tket::passes paths
tket/src/passes/replace_types/linearize.rs Updates doc links/tests to tket::passes paths
tket/src/passes/test_utils.rs Adds in-crate test helpers for moved pass tests
tket/src/passes/untuple.rs Updates imports/tests to tket::passes paths
tket/src/passes/utils.rs Replaces hugr_passes re-export with local hash module export
tket/src/passes/utils/hash.rs Updates test imports to new tket::passes::test_utils
tket/src/passes/validation.rs Adds validation utility type (currently not wired into module tree)
tket/Cargo.toml Removes hugr-passes dependency; adds ascent, pastey, thiserror, proptest dev deps
tket-qsystem/Cargo.toml Removes hugr-passes dependency
tket-qsystem/tests/guppy_opt.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/lib.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/lower_drops.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/llvm/qsystem.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/replace_bools.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/replace_bools/static_array.rs Switches imports from hugr_passes to tket::passes
tket-qsystem/src/extension/qsystem/lower.rs Switches types/errors/imports from hugr_passes to tket::passes
tket-qsystem/src/extension/qsystem/barrier.rs Switches Preserve import to tket::passes::composable
tket-qsystem/src/extension/qsystem/barrier/barrier_inserter.rs Switches ReplaceTypes import to tket::passes
tket-py/Cargo.toml Removes hugr-passes dependency
tket-py/src/passes.rs Switches ComposablePass import to tket::passes
qis-compiler/Cargo.toml Removes hugr-passes dependency
qis-compiler/rust/lib.rs Switches ComposablePass import to tket::passes
Cargo.toml Removes hugr-passes from workspace members/default-members
Cargo.lock Removes hugr-passes package entry; adds new tket deps (ascent/proptest/etc.)
release-plz.toml Removes hugr-passes package release entry
.github/workflows/ci.yml Removes benchmark override and nextest targets for removed hugr-passes package
.github/workflows/unsoundness.yml Updates comment label from hugr-passes to tket::passes
.github/change-filters.yml Removes hugr-passes/** from rust change filter
hugr-passes/src/lib.rs Removed (crate deleted from repo mainline)
hugr-passes/src/composable.rs Removed (crate deleted from repo mainline)
hugr-passes/README.md Removed (crate deleted from repo mainline)
hugr-passes/CHANGELOG.md Removed (crate deleted from repo mainline)
hugr-passes/Cargo.toml Removed (crate deleted from repo mainline)
hugr-passes/benches/bench_main.rs Removed (crate deleted from repo mainline)
hugr-passes/benches/benchmarks/mod.rs Removed (crate deleted from repo mainline)
hugr-passes/benches/benchmarks/hash.rs Removed (crate deleted from repo mainline)
hugr-passes/benches/benchmarks/examples.rs Removed (crate deleted from repo mainline)
Comments suppressed due to low confidence (1)

tket/src/passes.rs:99

  • The new passes/validation.rs file is not declared in this module, so it won’t be compiled or available under tket::passes. Either add a pub mod validation; (and re-export types if desired) or remove the file to avoid dead/unreachable code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tket/src/passes.rs
@aborgna-q
Copy link
Copy Markdown
Collaborator Author

I also removed old deprecated declarations, since the since = 0.24.0 attributes no longer make sense in the tket crate.

@aborgna-q aborgna-q force-pushed the ab/drop-hugr-passes branch from d69dc14 to 7ff9008 Compare April 1, 2026 15:25
@aborgna-q
Copy link
Copy Markdown
Collaborator Author

Added a snapshot update that broke after #1470

Comment thread tket/src/passes/replace_types/linearize.rs
@aborgna-q aborgna-q added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit cc5ca5c Apr 2, 2026
24 checks passed
@aborgna-q aborgna-q deleted the ab/drop-hugr-passes branch April 2, 2026 11:25
@hugrbot hugrbot mentioned this pull request Apr 2, 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