hugr
Quantinuum's common representation for quantum programs
What it is and what it does
hugr is a Python library that implements the Hierarchical Unified Graph Representation, a common intermediate representation for quantum programs used across the Quantinuum ecosystem. It provides a pure-Python data model and low-level API for constructing and manipulating HUGR objects, which represent quantum operations and programs as hierarchical graphs.
The library is designed as a foundational dependency for higher-level quantum tools like guppylang and tket, rather than as a direct end-user tool. It depends on pydantic for data validation, graphviz for visualization, semver for version handling, and typing-extensions for type support. The package is actively maintained and supports Python 3.10 through 3.14 with prebuilt wheels for most common platforms.
Use it for:
- Building intermediate representations of quantum programs for compilation and optimization pipelines
- Implementing quantum language frontends that need a common graph-based representation
- Analyzing and transforming quantum operations within the Quantinuum ecosystem
- Constructing quantum circuit graphs programmatically with type-safe validation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
hugr provides a pure-Python implementation of the Hierarchical Unified Graph Representation (HUGR) data model for constructing and manipulating quantum programs and operations in the Quantinuum ecosystem.
Yes, if you are building quantum tools or languages within the Quantinuum ecosystem or need a low-level quantum program representation. The library is actively maintained, has no known vulnerabilities, and uses a permissive license. Install friction is moderate due to compiled dependencies, but prebuilt wheels are available for most platforms. Not relevant for general-purpose Python development.
Install
hugr on PyPI
pip
pip install hugruv
uv add hugrpoetry
poetry add hugrInstalling hugr
Before you install
Medium install friction due to compiled wheels for multiple platforms and Python versions (cp310-abi3 through cp314). Active maintenance with a release 2 days old and recent commits. Requires Python 3.10 or later.
License in practice
Licensed under Apache Software License (permissive), which allows commercial and private use with minimal restrictions.
Quickstart
pip install hugr
from hugr import Hugr
# Create a HUGR object for quantum program representation
hugr_obj = Hugr()
Requires Python 3.10 or later; prebuilt wheels available for common platforms but may require compilation on less common architectures.
Verify before relying
- Whether graphviz dependency requires system graphviz installation or is bundled
- Specific use cases and API patterns beyond 'low-level construction' mentioned in description
- Performance characteristics or scalability limits for large quantum programs
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 5 — graphviz, pydantic, pydantic-extra-types, semver, typing-extensions |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 92,770/month — #13,428 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hugr-0.18.4-cp310-abi3-macosx_10_12_x86_64.whl; hugr-0.18.4-cp310-abi3-macosx_11_0_arm64.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_aarch64.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_armv7l.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_i686.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_ppc64le.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_s390x.whl; hugr-0.18.4-cp310-abi3-manylinux_2_28_x86_64.whl; hugr-0.18.4-cp310-abi3-musllinux_1_2_aarch64.whl; hugr-0.18.4-cp310-abi3-musllinux_1_2_armv7l.whl; hugr-0.18.4-cp310-abi3-musllinux_1_2_i686.whl; hugr-0.18.4-cp310-abi3-musllinux_1_2_x86_64.whl; hugr-0.18.4-cp310-abi3-win32.whl; hugr-0.18.4-cp310-abi3-win_amd64.whl; hugr-0.18.4-cp314-cp314t-macosx_10_12_x86_64.whl; hugr-0.18.4-cp314-cp314t-macosx_11_0_arm64.whl; hugr-0.18.4-cp314-cp314t-manylinux_2_28_aarch64.whl; hugr-0.18.4-cp314-cp314t-manylinux_2_28_armv7l.whl; hugr-0.18.4-cp314-cp314t-manylinux_2_28_i686.whl; hugr-0.18.4-cp314-cp314t-manylinux_2_28_ppc64le.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
qiskit-terraQiskit Terra provides the core SDK for building…
permissive · top 15,000 on PyPI
cirq-coreCirq-core provides the foundational framework…
permissive · top 15,000 on PyPI
cirqCirq is a Python framework for writing,…
permissive · top 15,000 on PyPI
qiskitQiskit is an open-source SDK for building and…
permissive · top 5,000 on PyPI
dwave-graphsProvides graph representations and algorithms…
permissive · top 15,000 on PyPI
qiskit-aerAer is a high-performance quantum circuit…
permissive · top 5,000 on PyPI
cirq-webProvides browser-based 3D visualization tools…
permissive · top 15,000 on PyPI
onnx-ironnx-ir provides an in-memory intermediate…
permissive · top 5,000 on PyPI
qiskit-ionqQiskit IonQ Provider enables submission of…
permissive · top 15,000 on PyPI
dwave-networkxExtends NetworkX with tools for D-Wave quantum…
permissive · top 15,000 on PyPI