Skip to content

fix: allow both _composable_pass and composable_pass imports#2965

Merged
aborgna-q merged 4 commits intomainfrom
fix/alias_composable_pass
Mar 19, 2026
Merged

fix: allow both _composable_pass and composable_pass imports#2965
aborgna-q merged 4 commits intomainfrom
fix/alias_composable_pass

Conversation

@CalMacCQ
Copy link
Contributor

@CalMacCQ CalMacCQ commented Mar 18, 2026

resolves breakage in #2962 by allowing both from _composable_pass and from composable_pass imports. This is a problem as in tket-py we access the private module _composable_pass for the implementation of PytketHugrPass (not the best practice on my part).

I've added a duplicate _composable_pass.py file now with a wildcard import (gross)

Will remove this once we have _composable_pass usage removed from tket-py. There shouldn't be any _scope usage in the tket-py main branch.

Theres probably a nicer way to do this with something like

import sys
sys.modules["_foo"] = sys.modules[__name__]

However this wasn't immediately working for me.

Related #2961

@CalMacCQ CalMacCQ requested a review from a team as a code owner March 18, 2026 17:50
@CalMacCQ CalMacCQ requested review from doug-q and maximilianruesch and removed request for doug-q March 18, 2026 17:50
@CalMacCQ
Copy link
Contributor Author

I'm on holiday tomorrow so feel free to edit/merge in my absence if need be.

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.87%. Comparing base (856f92d) to head (badc4d2).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2965   +/-   ##
=======================================
  Coverage   83.87%   83.87%           
=======================================
  Files         267      268    +1     
  Lines       52943    52945    +2     
  Branches    46857    46857           
=======================================
+ Hits        44408    44410    +2     
  Misses       6266     6266           
  Partials     2269     2269           
Flag Coverage Δ
python 88.84% <100.00%> (+<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.

import pytest

from hugr.hugr.base import Hugr
from hugr.passes._composable_pass import *
Copy link
Contributor Author

@CalMacCQ CalMacCQ Mar 18, 2026

Choose a reason for hiding this comment

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

Added this extra line to test that you can actually use both import paths.

@CalMacCQ CalMacCQ changed the title fix: allow _composable_pass and composable_pass imports fix: allow both _composable_pass and composable_pass imports Mar 18, 2026
@aborgna-q aborgna-q added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit 0a5664d Mar 19, 2026
29 checks passed
@aborgna-q aborgna-q deleted the fix/alias_composable_pass branch March 19, 2026 15:02
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