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

Add metadata support to hugr-py #1319

Closed
aborgna-q opened this issue Jul 17, 2024 · 0 comments · Fixed by #1428 or #1423
Closed

Add metadata support to hugr-py #1319

aborgna-q opened this issue Jul 17, 2024 · 0 comments · Fixed by #1428 or #1423
Assignees
Labels
good first issue Good for newcomers

Comments

@aborgna-q
Copy link
Collaborator

No description provided.

@ss2165 ss2165 self-assigned this Jul 17, 2024
@aborgna-q aborgna-q added the good first issue Good for newcomers label Jul 25, 2024
@ss2165 ss2165 assigned aborgna-q and unassigned ss2165 Aug 14, 2024
github-merge-queue bot pushed a commit that referenced this issue Aug 14, 2024
Adds a dictionary with metadata to the nodes.
`ToNode` now has a `metadata` property, so we can use
```python
d = Dfg(...)
d.metadata["key"] = 42

n = d.hugr.add_node(..., metadata={"something": "value"})
assert n.metadata["something"] == "value"
```

I chosed not to add a `metadata` argument to all the `add_{container}`
methods in DfgBase to avoid cluttering the API.

Closes #1319
github-merge-queue bot pushed a commit that referenced this issue 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 <121866228+aborgna-q@users.noreply.github.com>
github-merge-queue bot pushed a commit to CQCL/guppylang that referenced this issue Aug 21, 2024
This is an in-progress transplant of guppy from using an ad-hoc `Hugr`
definition into the builder from the `hugr` library.

The main mismatch between the old and new builders is that guppy used to
lazily add typed ports to the graph nodes as it needed. Since the new
builder requires operations to define their signature, we end up having
to edit the code everywhere from `guppylang.compiler` to the
`guppylang.prelude` definitions.

My first goal is to get this working, and then I will try and split some
changes from this PR (although most of it will have to be merged
monolithically).
 
Current test status:
- 390 $\color{green}\text{passed}$
- 14 $\color{yellow}\text{skipped}$
- 0 $\color{red}\text{failed}$

These issues currently breake some tests. I'll fix them before merging
the PR
- CQCL/hugr#1319
  ~~Required to store the module names in the hugr metadata~~
- CQCL/hugr#1424
  ~~Required for pytket and llvm integration~~
- ~~Release hugr and tket2 with the latest changes~~

Closes #257. Closes #85

BREAKING CHANGE: Removed `guppylang.hugr_builder.hugr.Hugr`, compiling a
module returns a `hugr.Hugr` instead.

---------

Co-authored-by: Mark Koch <48097969+mark-koch@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants