From e3da1eca85e67890e4bd96154fdcde8b129b0243 Mon Sep 17 00:00:00 2001 From: Seyon Sivarajah Date: Fri, 19 Jan 2024 16:18:14 +0000 Subject: [PATCH] feat: add top-level imports (#125) Closes #123 Closes #100 Closes #127 --- README.md | 5 ++--- guppylang/__init__.py | 6 +++++- ruff.toml | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0375287..2675c763 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/guppylang/__init__.py b/guppylang/__init__.py index bbe52f53..a6ac6ec0 100644 --- a/guppylang/__init__.py +++ b/guppylang/__init__.py @@ -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 diff --git a/ruff.toml b/ruff.toml index cfe3fd0a..6ba9dbb8 100644 --- a/ruff.toml +++ b/ruff.toml @@ -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"