Skip to content

Commit

Permalink
feat: add top-level imports (#125)
Browse files Browse the repository at this point in the history
Closes #123 
Closes #100 
Closes #127
  • Loading branch information
ss2165 authored Jan 19, 2024
1 parent 5204850 commit e3da1ec
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ Guppy is a quantum programming language that is fully embedded into Python.
It allows you to write high-level hybrid quantum programs with classical control flow and mid-circuit measurements using Pythonic syntax:

```python
from guppylang import guppy, Qubit
from guppylang import guppy, Qubit, quantum

import guppylang.prelude.quantum as quantum
guppy.load(quantum)

# Teleports the state in `src` to `tgt`.
@guppy
def teleport(src: Qubit, tgt: Qubit) -> Qubit:
"""Teleports the state in `src` to `tgt`."""
# Create ancilla and entangle it with src and tgt
tmp = Qubit()
tmp, tgt = cx(h(tmp), tgt)
Expand Down
6 changes: 5 additions & 1 deletion guppylang/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
__all__ = ["types.py"]
from guppylang.decorator import guppy
from guppylang.module import GuppyModule
from guppylang.prelude import builtins, quantum
from guppylang.prelude.builtins import Bool, Float, Int, List, linst
from guppylang.prelude.quantum import Qubit
1 change: 1 addition & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ ignore = [
"guppy/decorator.py" = ["B010"]
"tests/integration/*" = ["F841", "C416", "RUF005"]
"tests/{hugr,integration}/*" = ["B", "FBT", "SIM", "I"]
"__init__.py" = ["F401"] # module imported but unused

# [pydocstyle]
# convention = "google"
Expand Down

0 comments on commit e3da1ec

Please sign in to comment.