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

Uploaded Source

Built Distribution

guppylang-0.13.1-py3-none-any.whl (167.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: guppylang-0.13.1.tar.gz
  • Upload date:
  • Size: 338.4 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.1.tar.gz
Algorithm Hash digest
SHA256 7603378322df02761618df5cf2cdf08beb4a399bc7901fa065f35d6076460b34
MD5 36d75c22ad18367bb1915360a6a6362f
BLAKE2b-256 64425cfcf05f626644e011d4c0448fd3a582f339cd591c0495aec9a45d25bbea

See more details on using hashes here.

Provenance

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

Publisher: python-wheels.yml on CQCL/guppylang

Attestations:

File details

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

File metadata

  • Download URL: guppylang-0.13.1-py3-none-any.whl
  • Upload date:
  • Size: 167.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 518238ea5349623d89aa7066ce693a10576054bac90e2de6a88a14ac6f2f79a8
MD5 4efe5ffa9bf33c7e41053bf5bf896601
BLAKE2b-256 025bd06153d57a9ed51a536ce01ace04a92ef4636e12bc54aa3cd5a6bbc3cfad

See more details on using hashes here.

Provenance

The following attestation bundles were made for guppylang-0.13.1-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