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:
    # ...

package = main.compile()

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

from selene_hugr_qis_compiler import EmulatorState

state = EmulatorState.from_python(package)

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

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

Use EmulatorState.from_bytes(hugr_envelope) when loading a serialized HUGR package.

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

state = EmulatorState.from_python(hugr.package, platform="helios")

# Compile to LLVM IR for Apple Silicon
ir_apple_silicon = state.compile_to_llvm_ir(
    target_triple="aarch64-apple-darwin",
)
# Compile to LLVM bitcode for x86_64 MSVC
bitcode_x86_64_windows = state.compile_to_bitcode(
    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.

Metadata

Release files for selene-hugr-qis-compiler 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for selene-hugr-qis-compiler 0.5.1
File
selene_hugr_qis_compiler-0.5.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details
selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details
selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_x86_64.whl CPython 3.10 abi3 macOS 15.0+ x86-64 Details
selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_arm64.whl CPython 3.10 abi3 macOS 15.0+ ARM64 Details

Total release size: 146.3 MB

Release files / selene_hugr_qis_compiler-0.5.1-cp310-abi3-win_amd64.whl

Download URL selene_hugr_qis_compiler-0.5.1-cp310-abi3-win_amd64.whl
Size 25.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3b888b63fe96c9acf2fe32b02a379daf07d314e823ba9c5d46d2461a99897258
BLAKE2b-256 checksum
How to use checksums
7739510bd57c89cc4f6675a67eb1ea1c80928f309bb9e0bee56126e81c1a775f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_x86_64.whl
Size 35.0 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
7ecfe17bdee3eb8e0529d49ba43421d97ba0026c82cb6f6a997b2d9b3d5d664f
BLAKE2b-256 checksum
How to use checksums
819c77982a7b2610df39aa85ecfe6748c66fc7d7fa169dfebed5266c7c124137
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL selene_hugr_qis_compiler-0.5.1-cp310-abi3-manylinux_2_28_aarch64.whl
Size 34.2 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
3b66aaa2fa4f2e8799f93e4f2d91aaf46bddbe42a4fa4e72e55023840ebb0afe
BLAKE2b-256 checksum
How to use checksums
7b4d1ef953e8fcac7cc701115a269f73db14a79ecd4501d0aa78b17dc5755ca9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_x86_64.whl

Download URL selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_x86_64.whl
Size 26.7 MB
Tags CPython 3.10 abi3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
f3521a70293ef32ab76d2f456a6932542f19c3c4253cb833d5763c70a6724f7a
BLAKE2b-256 checksum
How to use checksums
5b2c9d20eb597d697a7ab6e63804fc86be5d93ea4def480e1338f0289edfa3b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_arm64.whl

Download URL selene_hugr_qis_compiler-0.5.1-cp310-abi3-macosx_15_0_arm64.whl
Size 25.2 MB
Tags CPython 3.10 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
7c2f1666ce763542934d1faa897830acbc970d722f884acef668c94b3878c0d4
BLAKE2b-256 checksum
How to use checksums
b2b4c6213d3bdc8ecead99c7f90b902fb8bbf56f41e0f754b1ff6a3d2f4d75e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page