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)!: Reexport commonly used classes from the package root #1393

Merged
merged 5 commits into from
Aug 5, 2024

Conversation

aborgna-q
Copy link
Collaborator

@aborgna-q aborgna-q commented Aug 2, 2024

I had to move serialization_version and delay a an import hugr to avoid cyclic dependencies.

drive-by: Import Edge / OrderEdge aliases from guppy

BREAKING CHANGE: Moved hugr.get_serialization_version to hugr.serialization.serial_hugr.serialization_version

@aborgna-q aborgna-q requested a review from a team as a code owner August 2, 2024 14:16
@aborgna-q aborgna-q requested review from zrho and ss2165 and removed request for zrho August 2, 2024 14:16
Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.65%. Comparing base (d554072) to head (79cbaa3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1393   +/-   ##
=======================================
  Coverage   87.64%   87.65%           
=======================================
  Files         118      118           
  Lines       20344    20349    +5     
  Branches    18035    18035           
=======================================
+ Hits        17831    17836    +5     
  Misses       1724     1724           
  Partials      789      789           
Flag Coverage Δ
python 91.65% <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.

@aborgna-q aborgna-q changed the title feat(hugr-py): Reexport commonly used classes from the package root feat(hugr-py)!: Reexport commonly used classes from the package root Aug 2, 2024
@aborgna-q aborgna-q force-pushed the ab/hugr-py-reexports branch 2 times, most recently from 566a2c5 to b77d3ac Compare August 2, 2024 15:59
@ss2165
Copy link
Member

ss2165 commented Aug 2, 2024

I am very wary - recommended practice now is to import from where things are defined and we risk tying our shoe laces together with circular imports

@aborgna-q aborgna-q requested review from acl-cqc and removed request for ss2165 August 5, 2024 09:37

def serialization_version() -> str:
"""Return the current version of the serialization schema."""
return "live"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really the best we can do? (Sorry - that sounds a bit rude! But I'd hope that it might be, oh, replaced with an actual version number by some part of the release process or something?? That would be fine, but if so I think it'd be good to have a comment here explaining that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not really happy with the unversioned versions, but it's the "no guarantees" value we are currently used. I guess we'll revisit it once hugr-model is implemented...

@@ -28,6 +28,8 @@ class Direction(Enum):

NodeIdx = int
PortOffset = int
Edge = tuple["OutPort", "InPort"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related? (Neither of these is re-exported)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not at all :P
It was part of the port of useful things from guppy, but I should probably remove it from here.

Copy link
Contributor

@acl-cqc acl-cqc left a comment

Choose a reason for hiding this comment

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

Thanks @aborgna-q - I approve of the move :), everything else looks fine, thanks :). My complaint about "live" is not a new issue in this PR, but I am nonetheless curious....

@aborgna-q aborgna-q added this pull request to the merge queue Aug 5, 2024
Merged via the queue into main with commit 69925d0 Aug 5, 2024
19 checks passed
@aborgna-q aborgna-q deleted the ab/hugr-py-reexports branch August 5, 2024 14:39
github-merge-queue bot pushed a commit that referenced this pull request Aug 12, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.6.0](hugr-py-v0.5.0...hugr-py-v0.6.0)
(2024-08-12)


### ⚠ BREAKING CHANGES

* **hugr-py:** Moved `hugr.get_serialization_version` to
`hugr.serialization.serial_hugr.serialization_version`
* **hugr-cli:** Cli validate command no longer has a mermaid option, use
`mermaid` sub-command instead.
* `TypeDefBound` uses struct-variants for serialization. `SignatureFunc`
now has variants for missing binary functions, and serializes in to a
new format that indicates expected binaries.

### Features

* `Package` pydantic model for modules + extensions
([#1387](#1387))
([68cfac5](68cfac5)),
closes [#1358](#1358)
* Define `Const` inline by default, and add a parameter to change the
parent ([#1404](#1404))
([3609736](3609736))
* **hugr-cli:** move mermaid to own sub-command
([#1390](#1390))
([77795b9](77795b9))
* **hugr-py:** add type_bound method to `Type`
([#1410](#1410))
([bd5ba47](bd5ba47)),
closes [#1365](#1365)
* **hugr-py:** Allow defining functions, consts, and aliases inside DFGs
([#1394](#1394))
([d554072](d554072))
* **hugr-py:** Reexport commonly used classes from the package root
([#1393](#1393))
([69925d0](69925d0))
* **py:** `Hugr.to_json` and `.load_json` helpers
([#1403](#1403))
([e7f9f4c](e7f9f4c))
* **py:** Allow pre-declaring a `Function`'s output types
([#1417](#1417))
([fa0f5a4](fa0f5a4))
* **py:** implement `iter` on `ToNode`
([#1399](#1399))
([e88910b](e88910b))
* **py:** Parametric int type helper, and arbitrary width int constants
([#1406](#1406))
([abd70c9](abd70c9))
* Serialised extensions
([#1371](#1371))
([31be204](31be204))


### Bug Fixes

* **py:** `Hugr.__iter__` returning `NodeData | None` instead of `Node`s
([#1401](#1401))
([c134584](c134584))
* **py:** Set output cont for Conditionals
([#1415](#1415))
([67bb8a0](67bb8a0))


### Documentation

* **hugr-py:** expand toctree
([#1411](#1411))
([aa81c9a](aa81c9a))
* **hugr-py:** remove multiversion + add justfile command
([#1381](#1381))
([dd1dc48](dd1dc48))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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