-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add bindings for tket1-passes from python #1225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1225 +/- ##
==========================================
- Coverage 78.61% 78.58% -0.03%
==========================================
Files 159 159
Lines 20184 20191 +7
Branches 19082 19089 +7
==========================================
Hits 15868 15868
- Misses 3345 3352 +7
Partials 971 971
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| try_with_circ(circ, |mut circ, typ| { | ||
| let mut pass = tket::passes::NormalizeGuppy::default(); | ||
|
|
||
| pass.simplify_cfgs(simplify_cfgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making all the parameter names match these names? If we extend them in future it could make things a bit easier.
| // TODO: We should also expose `target_gate` here, but the most appropriate | ||
| // parameter type [`crate::ops::PyTketOp`] doesn't include `TK2` -.- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only call clifford_simp with target_gate = CX for now.
We don't have a tket optype with both CX and TK2 variants, but if we really wanted to have this we could either accept a string or a pytket optype and convert it.
a02312d to
245ee9f
Compare
🤖 I have created a release *beep* *boop* --- ## [0.12.9](tket-py-v0.12.8...tket-py-v0.12.9) (2025-11-11) ### Features * Add bindings for tket1-passes from python ([[#1225](https://github.com/CQCL/tket2/issues/1225)](https://github.com/CQCL/tket2/pull/1225)) ([fce8084](fce8084)) --- 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]>
Adds some pass definitions to
tket.passes:normalize_guppy(Tk2Circuit, ...) -> Tk2Circuitclifford_simp(Tk2Circuit, *, allow_swaps = True, traverse_subcircuits = True) -> Tk2Circuitsquash_phased_rz(Tk2Circuit, *, traverse_subcircuits = True) -> Tk2CircuitThe last two use the new bridge to the old tket C++ codebase to run optimisation on regions of the hugr.
The API here not too ergonomic, we just expose it as a MVP while working on the API refresh.
To call this from a guppy program output, we'll need to convert the hugr to the rust representation and back,
drive-by: Add
Tk2Circuit.render_mermaidmethodBEGIN_COMMIT_OVERRIDE
feat: Add bindings for tket1-passes from python (#1225)
END_COMMIT_OVERRIDE