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.11.0.tar.gz (303.7 kB view details)

Uploaded Source

Built Distribution

guppylang-0.11.0-py3-none-any.whl (147.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for guppylang-0.11.0.tar.gz
Algorithm Hash digest
SHA256 84bb70ffa9a18d861f821f3b0968d793f7a0a666edea36542cf21242bbeda79f
MD5 f000be1a051c26bc6b1da323a55f1929
BLAKE2b-256 752a737eddd89aa01ea52d18762a5b95c6f1cc2387566dc4f838e92a5950c2fb

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for guppylang-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffb42e246b49458af4a6db878023cf674bc405c5d4a43cc73cee9761acc4ec59
MD5 55e33fee91e7ec3bc2ae3381999f7f39
BLAKE2b-256 403a48c9e0466c7c38e093ba08a616f000e8220bd6850a8fec395705c9733d31

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