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

Instantiate extension operations from an OpDef in python #1512

Closed
aborgna-q opened this issue Sep 3, 2024 · 0 comments · Fixed by #1576 or #1548
Closed

Instantiate extension operations from an OpDef in python #1512

aborgna-q opened this issue Sep 3, 2024 · 0 comments · Fixed by #1576 or #1548
Labels
enhancement New feature or request python Pull requests that update Python code

Comments

@aborgna-q
Copy link
Collaborator

So we can use the parametric extension operations

op_def: OpDef = hugr.std.collections.EXTENSION.get_op("push")
# Instantiate `push` with some element type
# This method does not exist
concrete_op: ExtOp = op_def.instantiate(args, sig=optional_signature)
builder.add_op(concrete_op, list, elem)

The current workaround requires manually instantiating ops.ExtOp with a signature and arguments, and setting the private _op_def field.

@aborgna-q aborgna-q added enhancement New feature or request python Pull requests that update Python code labels Sep 3, 2024
ss2165 added a commit that referenced this issue Oct 11, 2024
ss2165 added a commit that referenced this issue Oct 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 11, 2024
Closes #1512

drive-by: typos
github-merge-queue bot pushed a commit that referenced this issue Oct 14, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.9.0](hugr-py-v0.8.1...hugr-py-v0.9.0)
(2024-10-14)


### ⚠ BREAKING CHANGES

* `Package` moved to new `hugr.package` module
* The `length` op in the std `collections` extensions now also returns
the list.

### Features

* `instantiate` method for `OpDef`
([#1576](#1576))
([36548ab](36548ab)),
closes [#1512](#1512)
* define wrappers around package that point to internals
([#1573](#1573))
([f74dbf3](f74dbf3))
* to/from json for extension/package
([#1575](#1575))
([f8bf61a](f8bf61a)),
closes [#1523](#1523)


### Bug Fixes

* Make list length op give back the list
([#1547](#1547))
([cf31698](cf31698))

---
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 <agustin.borgna@quantinuum.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python Pull requests that update Python code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant