-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add method to load pytket circuit without function stub (#712)
Closes #670 Both finding the call location and then having either a node or a span for errors feels a bit hacky but I haven't been able to think of something better so far and it seems to work.
- Loading branch information
Showing
6 changed files
with
194 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: Tket2 not installed (at $FILE:14:0) | ||
| | ||
12 | module.load(qubit) | ||
13 | | ||
14 | guppy.load_pytket("guppy_circ", circ, module) | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Experimental pytket compatibility requires `tket2` to be | ||
| installed | ||
|
||
Help: Install tket2: `pip install tket2` | ||
|
||
Guppy compilation failed due to 1 previous error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pytket import Circuit | ||
|
||
from guppylang.decorator import guppy | ||
from guppylang.module import GuppyModule | ||
from guppylang.std.quantum import qubit | ||
|
||
circ = Circuit(2) | ||
circ.X(0) | ||
circ.Y(1) | ||
|
||
module = GuppyModule("test") | ||
module.load(qubit) | ||
|
||
guppy.load_pytket("guppy_circ", circ, module) | ||
|
||
@guppy(module) | ||
def foo(q: qubit) -> None: | ||
guppy_circ(q) | ||
|
||
|
||
module.compile() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters