Skip to main content

Pythonic quantum-classical programming language

Project description

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.prelude.quantum import cx, h, measure, qubit, x, z

@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)
    src, tmp = cx(src, tmp)

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

guppy.compile_module()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guppylang-0.12.0.tar.gz (311.0 kB view details)

Uploaded Source

Built Distribution

guppylang-0.12.0-py3-none-any.whl (150.2 kB view details)

Uploaded Python 3

File details

Details for the file guppylang-0.12.0.tar.gz.

File metadata

  • Download URL: guppylang-0.12.0.tar.gz
  • Upload date:
  • Size: 311.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for guppylang-0.12.0.tar.gz
Algorithm Hash digest
SHA256 df904496855689732f087da335b6c0611620c2b81c574d47f1090b2d1e8b991a
MD5 7e0d18351fcc0aada11952a1bfaa94fc
BLAKE2b-256 91ddcfe128680320f57ace35be03278d6833ecb98850c52bca6393c717cd3a54

See more details on using hashes here.

File details

Details for the file guppylang-0.12.0-py3-none-any.whl.

File metadata

  • Download URL: guppylang-0.12.0-py3-none-any.whl
  • Upload date:
  • Size: 150.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for guppylang-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1d954ad00316dd6cc1e47461a4c556685bf3b123898341048381a51f5522811
MD5 8c5dcc2ab3629b1923fa6e067f11f76d
BLAKE2b-256 2d3de816fd8a51fd52264e5c5d559df33a8c96d1358aefc2e61ba9cbd2eb0bfa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page