-
Notifications
You must be signed in to change notification settings - Fork 3
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: Local implicit modules for @guppy #105
Conversation
Tentatively adds a `compiled` option for directly generating a Hugr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
I wonder if it'd be better to have a different decorator that compiles directly to hugrs instead of the compile flag.
I think this depends on whether we want direct compilation of functions to be a user facing feature? I would tend to say no, since we're really only using it to write tests. In that case, we could just make it a local decorator in the tests
package
Would it ever be useful to directly compile to a hugr in a jupyter notebook? |
Do we even expect users to look at Hugrs? At least I think this would be an expert-level feature, so it would probably be fine to retrieve it from the module instead of making the decorator do it.
Agreed. So I think we can go ahead an move this to the |
I removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, LGTM 👍 Just some naming suggestions
`hugr` uses `gtypes`, which uses `hugr.tys`
🤖 I have created a release *beep* *boop* --- ## 0.2.0 (2024-04-11) ### ⚠ BREAKING CHANGES * Make `qubit` type lower case ([#165](#165)) ### Features * Local implicit modules for `@guppy` ([#105](#105)) ([f52a5de](f52a5de)) * New type representation with parameters ([#174](#174)) ([73e29f2](73e29f2)) ### Bug Fixes * Make ZZMax a dyadic operation ([#168](#168)) ([152485f](152485f)), closes [#154](#154) * Stop exiting interpreter on error ([#140](#140)) ([728e449](728e449)) * Use correct TK2 gate names ([#190](#190)) ([df92642](df92642)) ### Documentation * add reference to runner to readme ([#129](#129)) ([45c2bf0](45c2bf0)) * Add short description and simplify readme for pypi ([#136](#136)) ([667bba3](667bba3)) ### Code Refactoring * Make `qubit` type lower case ([#165](#165)) ([0a42097](0a42097)) ### Continuous Integration * Use `release-please bootstrap`'s default config ([#187](#187)) ([72e666a](72e666a)) --- 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Koch <[email protected]>
🤖 I have created a release *beep* *boop* --- ## 0.2.0 (2024-04-11) ### ⚠ BREAKING CHANGES * Make `qubit` type lower case ([#165](#165)) ### Features * Local implicit modules for `@guppy` ([#105](#105)) ([f52a5de](f52a5de)) * New type representation with parameters ([#174](#174)) ([73e29f2](73e29f2)) ### Bug Fixes * Make ZZMax a dyadic operation ([#168](#168)) ([152485f](152485f)), closes [#154](#154) * Stop exiting interpreter on error ([#140](#140)) ([728e449](728e449)) * Use correct TK2 gate names ([#190](#190)) ([df92642](df92642)) ### Documentation * add reference to runner to readme ([#129](#129)) ([45c2bf0](45c2bf0)) * Add short description and simplify readme for pypi ([#136](#136)) ([667bba3](667bba3)) ### Code Refactoring * Make `qubit` type lower case ([#165](#165)) ([0a42097](0a42097)) ### Continuous Integration * Use `release-please bootstrap`'s default config ([#187](#187)) ([72e666a](72e666a)) --- 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mark Koch <[email protected]>
Makes
@guppy
define local modules by default. Fixes #101._Guppy.set_module
_Guppy.compile
that compiles and returns the local module._Guppy.take_module
that returns the module without compiling it (and removes it from the local context).@guppy(compile=True)
option as a fall-back to the previous behaviour, where it directly compiles a Hugr.Look at the first commit. The second is just noise updating the tests to use the
compile
flag.I wonder if it'd be better to have a different decorator that compiles directly to hugrs instead of the
compile
flag.