Skip to content

feat: expose the QSystemPass to Python#1556

Open
CalMacCQ wants to merge 7 commits intomainfrom
cm/expose_qsystempass
Open

feat: expose the QSystemPass to Python#1556
CalMacCQ wants to merge 7 commits intomainfrom
cm/expose_qsystempass

Conversation

@CalMacCQ
Copy link
Copy Markdown
Contributor

@CalMacCQ CalMacCQ commented Apr 29, 2026

closes #1553

Driveby: now ncludes a fix to how we resolve extensions in Python. See 076c176. Prior to this fix the transformed HUGR contained Custom ops rather than QSystem ops as we would expect.

@CalMacCQ CalMacCQ requested a review from a team as a code owner April 29, 2026 16:27
@CalMacCQ CalMacCQ requested a review from cqc-alec April 29, 2026 16:27
@CalMacCQ CalMacCQ marked this pull request as draft April 29, 2026 16:27
Comment thread tket-py/src/passes.rs
scope: Option<PyPassScope>,
) -> PyResult<()> {
let py_scope = scope.unwrap_or_default();
let qsystem_pass = tket_qsystem::QSystemPass::default_with_scope(py_scope.scope)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

One flag that's missing here is hide_funcs which is in the QSystemPass rust struct. We should also expose this to Python right? There is no corresponding "with" method that I'm aware of.

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.

That looks like an unintended omission.

Could you add a with_hide_funcs method, and propagate it here?

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.81%. Comparing base (54e855f) to head (ca348e8).

Files with missing lines Patch % Lines
tket-py/tket/passes/__init__.py 90.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1556   +/-   ##
=======================================
  Coverage   83.80%   83.81%           
=======================================
  Files         188      188           
  Lines       29035    29056   +21     
  Branches    27931    27931           
=======================================
+ Hits        24334    24353   +19     
- Misses       3539     3541    +2     
  Partials     1162     1162           
Flag Coverage Δ
python 92.29% <91.30%> (-0.04%) ⬇️

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/__init__.py
Comment thread tket-py/tket/_tket/passes.pyi Outdated
Comment thread tket-py/test/test_pass.py Outdated
@CalMacCQ CalMacCQ marked this pull request as ready for review May 1, 2026 14:57
@CalMacCQ CalMacCQ requested review from aborgna-q and removed request for cqc-alec May 1, 2026 14:57
return program


@dataclass
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.

Since all parameters are boolean, let's mark them as kw_only to avoid someone calling QSystemPass(True, False, False, True).

Suggested change
@dataclass
@dataclass(kw_only=True)

Comment thread tket-py/src/passes.rs
scope: Option<PyPassScope>,
) -> PyResult<()> {
let py_scope = scope.unwrap_or_default();
let qsystem_pass = tket_qsystem::QSystemPass::default_with_scope(py_scope.scope)
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.

That looks like an unintended omission.

Could you add a with_hide_funcs method, and propagate it here?

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.

[Feature]: QSystemPass should be exposed to Python as a tket ComposablePass

2 participants