Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 1.7 KB

README.md

File metadata and controls

68 lines (44 loc) · 1.7 KB

Guppy

pypi codecov py-version

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:

from guppylang import guppy
from guppylang.std.builtins import owned
from guppylang.std.quantum import cx, h, measure, qubit, x, z


@guppy
def teleport(src: qubit @ owned, tgt: qubit) -> None:
    """Teleports the state in `src` to `tgt`."""
    # Create ancilla and entangle it with src and tgt
    tmp = qubit()
    h(tmp)
    cx(tmp, tgt)
    cx(src, tmp)

    # Apply classical corrections
    h(src)
    if measure(src):
        z(tgt)
    if measure(tmp):
        x(tgt)

guppy.compile_module()

More examples and tutorials are available here.

Install

Guppy can be installed via pip. Requires Python >= 3.10.

pip install guppylang

Usage

See the Getting Started guide and the other examples.

Development

See DEVELOPMENT.md for instructions on setting up the development environment.

License

This project is licensed under Apache License, Version 2.0 (LICENCE or http://www.apache.org/licenses/LICENSE-2.0).