skillfed

hugr

Quantinuum's common representation for quantum programs

hugr v0.18.4 92.8K downloads/30d#13,428 on PyPI67
Permissive license Active released

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 hugr

uv

uv add hugr

poetry

poetry add hugr

Installing 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

Environment :: ConsoleIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/Engineering

Tags

quantum program representationHUGR data modelquantum graph constructionquantum operation representationquantum program intermediate representationQuantinuum quantum toolsquantum circuit graph
quantum-computingintermediate-representation

More Scientific/Engineering packages