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

Uploaded Source

Built Distribution

guppylang-0.13.0-py3-none-any.whl (166.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: guppylang-0.13.0.tar.gz
  • Upload date:
  • Size: 337.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for guppylang-0.13.0.tar.gz
Algorithm Hash digest
SHA256 d8bbe5fc1c42a4225c2715ba76d5dc1f7f0c56b9b29590f0c03bc54d54ff359b
MD5 a2baf287c2cd46fec4332e39feb987fd
BLAKE2b-256 3a5c7799f3672bfea52103b74237bde607c4613360be64396d7c3c950bec3673

See more details on using hashes here.

Provenance

The following attestation bundles were made for guppylang-0.13.0.tar.gz:

Publisher: python-wheels.yml on CQCL/guppylang

Attestations:

File details

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

File metadata

  • Download URL: guppylang-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 166.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for guppylang-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dbc7f5c9f51222ec1b8c81ef4eb9f9af3841e0fdec0f23a7ce3480df198f43a
MD5 550e8bbe5f6fbf0d76e5af1231f5e6ea
BLAKE2b-256 a11d0ca70b23cad31ef0f9e58c7c8976b14ab97b9338e55733e6b340c2f6f4af

See more details on using hashes here.

Provenance

The following attestation bundles were made for guppylang-0.13.0-py3-none-any.whl:

Publisher: python-wheels.yml on CQCL/guppylang

Attestations:

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