Skip to content
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

feat(hugr-py)!: user facing Extension class #1413

Merged
merged 26 commits into from
Aug 14, 2024
Merged

feat(hugr-py)!: user facing Extension class #1413

merged 26 commits into from
Aug 14, 2024

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Aug 9, 2024

Allows users to define extensions in Python, attaching operation, type and value definitions to them. Also provides utilities for then using those objects when building HUGRs.

Diff is big, but a lot of it is poetry and schema changes. Open to suggestions as to how to break up but I think it is fairly self-contained.

Closes #1374
Closes #1412
Also as a drive-by adds the missing binary field to serialised opdef signatures.

BREAKING CHANGE: AsCustomOp replaced with AsExtOp, so all such operations now need to be attached to an extension.

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 82.12291% with 64 lines in your changes missing coverage. Please review.

Project coverage is 87.58%. Comparing base (3bf968f) to head (1873cc2).
Report is 1 commits behind head on main.

Files Patch % Lines
hugr-py/src/hugr/ext.py 81.32% 31 Missing ⚠️
hugr-py/src/hugr/serialization/extension.py 42.42% 19 Missing ⚠️
hugr-py/src/hugr/ops.py 90.00% 7 Missing ⚠️
hugr-py/src/hugr/tys.py 89.79% 5 Missing ⚠️
hugr-py/src/hugr/hugr.py 87.50% 1 Missing ⚠️
hugr-py/src/hugr/std/int.py 95.45% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1413      +/-   ##
==========================================
- Coverage   87.69%   87.58%   -0.12%     
==========================================
  Files         118      119       +1     
  Lines       20441    20751     +310     
  Branches    18045    18045              
==========================================
+ Hits        17926    18174     +248     
- Misses       1727     1789      +62     
  Partials      788      788              
Flag Coverage Δ
python 90.50% <82.12%> (-1.36%) ⬇️
rust 87.14% <ø> (ø)

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.

@ss2165 ss2165 force-pushed the ss/ext-class branch 3 times, most recently from ffa6021 to 879e033 Compare August 12, 2024 14:14
"ExtensionValue",
"Extension",
"Package",
"Version",
Copy link
Member Author

Choose a reason for hiding this comment

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

just so I can re-export Version without ruff complaining

@CQCL CQCL deleted a comment from hugrbot Aug 13, 2024
@ss2165 ss2165 marked this pull request as ready for review August 13, 2024 11:35
@ss2165 ss2165 requested a review from a team as a code owner August 13, 2024 11:35
@ss2165 ss2165 requested a review from cqc-alec August 13, 2024 11:35
Copy link
Collaborator

@cqc-alec cqc-alec left a comment

Choose a reason for hiding this comment

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

LGTM, some small comments.

@ss2165 ss2165 requested a review from cqc-alec August 14, 2024 10:46
@ss2165 ss2165 enabled auto-merge August 14, 2024 10:46
@ss2165 ss2165 added this pull request to the merge queue Aug 14, 2024
Merged via the queue into main with commit c6473c9 Aug 14, 2024
21 of 22 checks passed
@ss2165 ss2165 deleted the ss/ext-class branch August 14, 2024 12:08
github-merge-queue bot pushed a commit that referenced this pull request Aug 14, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](hugr-py-v0.6.0...hugr-py-v0.7.0)
(2024-08-14)


### ⚠ BREAKING CHANGES

* **hugr-py:** `AsCustomOp` replaced with `AsExtOp`, so all such
operations now need to be attached to an extension.

### Features

* **hugr-py:** user facing Extension class
([#1413](#1413))
([c6473c9](c6473c9))
* **py:** Add node metadata
([#1428](#1428))
([b229be6](b229be6)),
closes [#1319](#1319)


### Bug Fixes

* Equality check between `Sum` types
([#1422](#1422))
([8dfea09](8dfea09))
* **py:** Invalid serialization of float and int constants
([#1427](#1427))
([b89c08f](b89c08f))

---
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]>
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.

Resolve serialised types/ops to extensions in python Define user facing python Extension classes.
2 participants