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

Implicit module imports #133

Closed
Tracked by #424
mark-koch opened this issue Jan 24, 2024 · 0 comments · Fixed by #461
Closed
Tracked by #424

Implicit module imports #133

mark-koch opened this issue Jan 24, 2024 · 0 comments · Fixed by #461
Assignees
Labels
enhancement New feature or request

Comments

@mark-koch
Copy link
Collaborator

Following the changes in #105, it would be nice if we could avoid gupply.load(...) calls and instead read of the imported Guppy modules from the Python environment.

from guppy import Qubit

@guppy
def foo(q: Qubit) -> Qubit:
   ...

guppy.compile()  # Sees that `Qubit` is in scope, so automatically imports the corresponding `quantum` module
@mark-koch mark-koch added the enhancement New feature or request label Jan 24, 2024
@mark-koch mark-koch self-assigned this Jan 24, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 11, 2024
Closes #133 and closes #462.

* When using implicit modules, automatically import definitions by
inspecting the `__dict__` of the containing Python module.
* Implicit modules are no longer discarded once they are compiled for
the first time.
* Updated examples to use implicit modules

BREAKING CHANGE: `guppy.take_module` renamed to `guppy.get_module` and
no longer removes the module from the state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant