feat!: Allow multiple versions of an extension in an ExtensionRegistry#3005
Merged
feat!: Allow multiple versions of an extension in an ExtensionRegistry#3005
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3005 +/- ##
==========================================
- Coverage 81.30% 81.30% -0.01%
==========================================
Files 240 240
Lines 45356 45392 +36
Branches 39160 39160
==========================================
+ Hits 36876 36905 +29
- Misses 6490 6497 +7
Partials 1990 1990
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:
|
cqc-alec
approved these changes
Apr 1, 2026
hugr-py/src/hugr/ext.py
Outdated
| """ | ||
|
|
||
| id: ExtensionId | ||
| latest_version: Version |
Collaborator
There was a problem hiding this comment.
Maybe id and latest_version could be underscored as well?
Collaborator
Author
There was a problem hiding this comment.
Made them hidden, and added an id(self) getter. The latest version can be accessed via .latest.version
github-merge-queue bot
pushed a commit
that referenced
this pull request
Apr 1, 2026
🤖 I have created a release *beep* *boop* --- ## [0.16.0](hugr-py-v0.15.4...hugr-py-v0.16.0) (2026-04-01) This release changes the default text serialization format from JSON to `MODEL_WITH_EXTS` (the JSON format is now deprecated). It also adds the ability to link packages and modules from Python, renders operation type arguments in HUGR visualizations, introduces a new `debug_info` module for attaching source-level debug metadata to nodes, and introduces multi-version support in `ExtensionRegistry`, allowing different versions of the same extension to coexist in the same registry. ### ⚠ BREAKING CHANGES * `ExtensionRegistry` may now contain multiple versions of the same extension. `.extensions` is now an iterator of the latest versions instead of a dictionary. `.register_updated` and `.add_extension` have been replaced with a singular `.register`. * Default `EnvelopeConfig` changed from `EnvelopeFormat.JSON` to `EnvelopeFormat.MODEL_WITH_EXTS`. * Substituted `hugr-py/src/hugr/tys.py::_type_str` with `hugr-py/src/hugr/utils.py::name_w_args`. ### Features * Add debug info metadata specification in `hugr-py` ([#2971](#2971)) ([a4da8ef](a4da8ef)) * Allow multiple versions of an extension in an ExtensionRegistry ([#3005](#3005)) ([ee90cd1](ee90cd1)) * Deprecate JSON serialization format ([#2991](#2991)) ([0f7a880](0f7a880)) * Operation parameter rendering in HUGR visualizations ([#2995](#2995)) ([d619148](d619148)) * Allow linking packages and modules from Python ([#2947](#2947)) ([329c243](329c243)) * Make `_composable_pass` and `_scope` public modules ([#2962](#2962)) ([1d6af9a](1d6af9a)), closes [#2961](#2961) * Allow missing ext versions ExtensionDesc metadata ([#2979](#2979)) ([bc1c445](bc1c445)) * Allow dfg conversion in to TrackedDfg ([#2993](#2993)) ([3bd7a88](3bd7a88)) ### Bug Fixes * Allow both _composable_pass and composable_pass imports ([#2965](#2965)) ([0a5664d](0a5664d)) * Allow both _scope and scope imports ([#3003](#3003)) ([de0458c](de0458c)) * Always do extension resolution when loading packages and hugrs ([#2953](#2953)) ([0086d2a](0086d2a)) * Correct pyo3 module definitions and add missing exception class export ([#2964](#2964)) ([3df73f4](3df73f4)) * Include extensions during link serialization ([#2992](#2992)) ([9236e89](9236e89)) * Prefix names with underscores during serialization ([#2989](#2989)) ([8aab636](8aab636)) * Use valid identifiers when constructing AST model ([#2973](#2973)) ([8750a6b](8750a6b)) --- 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Breaking part of #3000 for the python interface:
Allows
ExtensionRegistryes to contain multiple versions of the same registry.Since the
extensionsattribute was public changing this was a breaking change.This PR replaces it with a
versioned_extensions: dict[ExtensionId, ExtensionVersions], whereExtensionVersionscontains multiple versions of the same extension.It also modifies a couple methods to expose the new behaviour.
We are not actually exploiting the multi-version capability yet. That will be done in a PR actually addressing #3000.
BREAKING CHANGE:
ExtensionRegistrymay now contain multiple versions of the same extension..extensionsis now an iterator of the latest versions instead of a dictionary..register_updatedand.add_extensionhave been replaced with a singular.register.