Skip to main content

The HUGR-QIS compiler for Selene

This package provides compilation from HUGR to LLVM adhering to the Quantinuum QIS.

Usage

Guppy can produce a HUGR Envelope with:

from guppylang.decorator import guppy

@guppy
def main() -> None:
    # ...

hugr = main.compile()
hugr_envelope = hugr.package.to_bytes()

This can then be compiled to LLVM IR or bitcode using this package:

from qis_compiler import (
    compile_to_llvm_ir,
    compile_to_bitcode,
)

# Compile to LLVM IR for the host system
# and receive it as a string
ir = compile_to_llvm_ir(hugr_envelope)

# Compile to LLVM bitcode for the host system
# and receive it as a bytes object
bitcode = compile_to_bitcode(hugr_envelope)

If you wish to target a specific architecture or platform, you can pass the triple as an argument to the compilation functions:

# Compile to LLVM IR for Apple Silicon
ir_apple_silicon = compile_to_llvm_ir(
    hugr_envelope,
    target_triple="aarch64-apple-darwin",
)
# Compile to LLVM bitcode for x86_64 MSVC
bitcode_apple_silicon = compile_to_bitcode(
    hugr_envelope,
    target_triple="x86_64-windows-msvc",
)

Development

Snapshot testing

This package uses snapshot testing for its compiler output. Sample programs are defined using guppy in the script python/tests/generate_hugrs.py. To add a new test case add a new function to generate the desired HUGR program and call it from the if __name__ == "__main__": block.

The script has self contained dependencies with a pinned guppy version defined in comments at the top of the file. uv will create a virtual environment and install the dependencies when you run the script with uv run python tests/generate_hugrs.py. This can also be done using just regenerate in the python/tests directory.

HUGR regeneration should not be done in conjunction with other changes to the compiler, to isolate possible changes to the snapshots. It should only be required if guppylang updates are required for testing the compiler.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

selene_hugr_qis_compiler-0.4.2-cp310-abi3-win_amd64.whl (28.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_x86_64.whl (83.8 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_aarch64.whl (75.9 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_x86_64.whl (30.5 MB view details)

Uploaded CPython 3.10+macOS 15.0+ x86-64

selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_arm64.whl (29.9 MB view details)

Uploaded CPython 3.10+macOS 15.0+ ARM64

File details

Details for the file selene_hugr_qis_compiler-0.4.2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2bbc77d3444d1050c36ea3eb8e762e46a5c8b0048fd5d62d9f9fee8e58c15701
MD5 d37b911a9260934ebe9e831b0b43574c
BLAKE2b-256 2a7f4b4fe9e9ec7a1d5007195f31f9d58866a560d61c21a208bfc55067ce253c

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.2-cp310-abi3-win_amd64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e04190bf7b11f3c40b752702d83bcf9531aa8717b273f386af3897b665926a6b
MD5 128f7c08697123281cd762014abd3a00
BLAKE2b-256 3e38c6ee8f07bcc11977f0bb756ce20655e54d093197e3eba57d7afecbdafb76

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 daeb357c3aa643a5eb08fdde60df5f7314e57561497737845212ffa7b379941d
MD5 b5beb1409a56e9889e511dd15dea1900
BLAKE2b-256 0ead01c53776ac5a3979dae2f3188607b3320669db8c145f94b274785ef41a73

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.2-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 827b0ac106c9bbcd24e39f70b2d4ea6e0dbc28a59329d31d08bbc025dba4b90c
MD5 a08751c04461eba50de85988af1fa73f
BLAKE2b-256 59d09b88bbacb915c7566dea1ff27f4c59fb677d0e4db34c1df6203d300bf9b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_x86_64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 754d63ae54826b9e81263d935f4c73c619c49cd80c0bfeb2081a52211cabf68f
MD5 75ff879d8c4a96ff45ffb033ba4011ff
BLAKE2b-256 24f68bc040c3ae57ea79dbcd56eca6a8b74a5403436907cdf6cfe6e20bb2a8ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for selene_hugr_qis_compiler-0.4.2-cp310-abi3-macosx_15_0_arm64.whl:

Publisher: python-qis-wheels.yml on Quantinuum/tket2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page