skillfed

pyqir

pyqir v0.12.5 92.7K downloads/30d#13,433 on PyPI82
Permissive license Active released

What it is and what it does

PyQIR is a low-level toolkit for generating and analyzing QIR, a standardized intermediate representation for quantum programs. It is designed as a bridge for code automation and translation tools—not as a framework for direct quantum algorithm development. The package provides builders like BasicQisBuilder and SimpleModule to construct quantum operations (gates, measurements) and emit them as QIR, which can then be parsed, analyzed, or passed to downstream quantum compilers and execution platforms.

The package supports modern Python versions (3.9–3.13) and is distributed as compiled wheels for macOS, Linux, and Windows on both x86_64 and ARM64 architectures. As of version 0.12, it defaults to LLVM opaque pointers and QIR major version 2, though earlier versions are available for typed pointer compatibility. It has no runtime dependencies beyond the Python standard library.

Use it for:

  • Translate quantum programs from domain-specific languages or frameworks into standardized QIR for cross-platform compilation
  • Build QIR generation backends for quantum programming tools and compilers
  • Parse and analyze existing QIR code for optimization, validation, or transformation
  • Integrate quantum code generation into classical Python automation pipelines

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyQIR generates, parses, and analyzes QIR (Quantum Intermediate Representation) code, serving as a low-level bridge for translating quantum programs into QIR format rather than as a user-facing quantum development framework.

Yes, if you are building quantum compiler infrastructure or translation tools that need to emit or consume QIR. No, if you are writing quantum algorithms directly—use a higher-level quantum framework instead. The package is actively maintained, has no known vulnerabilities, and carries permissive licensing, but it is explicitly designed for tool developers, not end users.

Install

pyqir on PyPI

pip

pip install pyqir

uv

uv add pyqir

poetry

poetry add pyqir

Installing pyqir

Before you install

Medium install friction due to compiled wheels for multiple platforms (macOS, Linux, Windows on x86_64 and ARM64); actively maintained with recent releases and no known vulnerabilities.

License in practice

Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions.

Quickstart

pip install pyqir

from pyqir import BasicQisBuilder, SimpleModule

module = SimpleModule("Bell", num_qubits=2, num_results=2)
qis = BasicQisBuilder(module.builder)
qis.h(module.qubits[0])
qis.cx(module.qubits[0], module.qubits[1])
print(module.ir())

Requires Python 3.9 or later; PyQIR 0.12 produces QIR with opaque pointers (LLVM 18+) and major version 2 by default—use 0.11 or earlier for typed pointer output.

Verify before relying

  • Whether the package is suitable for frameworks other than those explicitly mentioned in the description
  • Performance characteristics when parsing or generating large QIR programs
  • Specific quantum computing platforms or backends that integrate with PyQIR

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 94 days since the last release
Last repo commit
First released
Downloads 92,693/month — #13,433 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyqir-0.12.5-cp39-abi3-macosx_10_12_x86_64.whl; pyqir-0.12.5-cp39-abi3-macosx_11_0_arm64.whl; pyqir-0.12.5-cp39-abi3-manylinux_2_34_x86_64.whl; pyqir-0.12.5-cp39-abi3-manylinux_2_38_aarch64.whl; pyqir-0.12.5-cp39-abi3-win_amd64.whl; pyqir-0.12.5-cp39-abi3-win_arm64.whl

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Rust

Tags

quantum intermediate representation generationQIR parsing and analysisquantum code translation to QIRLLVM quantum IR toolsquantum compiler backend
quantum-computingcompiler-infrastructureintermediate-representation

More Scientific/Engineering packages