Skip to content

CQCL/guppylang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0379902 · Apr 29, 2025
Mar 31, 2025
Dec 17, 2024
Feb 28, 2025
Apr 2, 2025
Apr 29, 2025
Apr 26, 2025
Dec 17, 2024
Jun 28, 2023
Feb 13, 2025
Mar 7, 2025
Apr 29, 2025
Apr 23, 2025
Apr 29, 2025
Apr 23, 2025
Apr 23, 2025
Mar 18, 2025
Jan 10, 2024
Dec 7, 2023
Feb 21, 2025
Mar 4, 2024
Mar 21, 2025
Mar 21, 2025
Jan 24, 2024
Mar 18, 2025
Apr 29, 2025
Nov 15, 2024
Mar 24, 2025
Aug 16, 2024
Apr 29, 2025

Repository files navigation

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

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).