Skip to content

feat(hugr-py): Allow linking packages and modules from Python#2947

Open
maximilianruesch wants to merge 11 commits intomainfrom
mr/feat/py-linking
Open

feat(hugr-py): Allow linking packages and modules from Python#2947
maximilianruesch wants to merge 11 commits intomainfrom
mr/feat/py-linking

Conversation

@maximilianruesch
Copy link
Contributor

Adds capabilities to hugr-py to allow linking modules and entire packages together. This is a required feature for Guppy libraries, found in Quantinuum/guppylang#1481, and could be considered the core feature for the same.

hugr-core needed a slight modification to allow reading a module from an envelope (with all the builtin validation around expecting a single module) while also returning the extensions present in the envelope. The functions are exposed via pyo3 bindings to Python and tested there.

@codecov
Copy link

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 62.50000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.83%. Comparing base (93aac28) to head (8ca8496).

Files with missing lines Patch % Lines
hugr-core/src/hugr.rs 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2947      +/-   ##
==========================================
- Coverage   83.84%   83.83%   -0.01%     
==========================================
  Files         267      267              
  Lines       52923    52947      +24     
  Branches    46854    46863       +9     
==========================================
+ Hits        44371    44387      +16     
- Misses       6283     6291       +8     
  Partials     2269     2269              
Flag Coverage Δ
python 88.80% <100.00%> (+0.04%) ⬆️
rust 83.18% <0.00%> (-0.02%) ⬇️

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.

@maximilianruesch maximilianruesch marked this pull request as ready for review March 16, 2026 15:28
@maximilianruesch maximilianruesch requested a review from a team as a code owner March 16, 2026 15:28
@maximilianruesch
Copy link
Contributor Author

Note: I am unsure where to add tests for hugr-core, and which tests to add specifically. Currently, the function is covered by hugr-py tests implicitly.

Also, one could consider whether we should refactor load to call load_with_exts and just ignore the exsts.

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.

1 participant