Skip to main content

qBraid-SDK extension providing support for QIR conversions.

Project description

qbraid-qir-header

CI GitHub Pages PyPI Downloads PyPI version PyPI version License Discord

qBraid-SDK extension providing support for QIR conversions.

Motivation

qir

This project aims to make QIR representations accessible via the qBraid-SDK transpiler, and by doing so, open the door to language-specific conversions from any and all high-level quantum languages supported by qbraid. See QIR Alliance: why do we need it?.

Installation

qBraid-QIR requires Python 3.10 or greater, and can be installed with pip as follows:

pip install qbraid-qir

Optional dependencies

qBraid-QIR offers integrations that require extra (optional) dependencies, which can be installed as follows:

For OpenQASM 3 to QIR conversions, install the qasm3 extra:

pip install 'qbraid-qir[qasm3]'

For Cirq to QIR conversions, install the cirq extra:

pip install 'qbraid-qir[cirq]'

For QIR to SQUIN conversions, install the squin extra:

pip install 'qbraid-qir[squin]'

Install from source

You can also install from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/qBraid/qbraid-qir.git
cd qbraid-qir
pip install .

To include optional dependencies when installing from source, use the same "extras_require" format, e.g.

pip install '.[qasm3,cirq,squin]'

Check version

You can view the version of qbraid-qir you have installed within a Python shell as follows:

import qbraid_qir

qbraid_qir.__version__

Resources

Usage examples

OpenQASM 3 conversions

from qbraid_qir import qasm3_to_qir

program = """
OPENQASM 3;
include "stdgates.inc";

qubit[2] q;
bit[2] c;

h q[0];
cx q[0], q[1];

measure q[0] -> c[0];
measure q[1] -> c[1];
"""

module = qasm3_to_qir(program, name="my-program")

ir = str(module)

Cirq conversions

import cirq
from qbraid_qir import cirq_to_qir

q0, q1 = cirq.LineQubit.range(2)

circuit = cirq.Circuit(
  cirq.H(q0),
  cirq.CNOT(q0, q1),
  cirq.measure(q0, q1)
)

module = cirq_to_qir(circuit, name="my-circuit")

ir = str(module)

SQUIN conversions

from pyqir import BasicQisBuilder, SimpleModule
from qbraid_qir.squin import load

module = SimpleModule("ghz_n", num_qubits=2, num_results=2)
qis = BasicQisBuilder(module.builder)

qis.h(module.qubits[0])
qis.cx(module.qubits[0], module.qubits[1])

squin_module = load(module.ir())

squin_module.print()

Architecture diagram

qBraid-SDK transpiler hub-and-spokes architecture with qbraid-qir integration (left) mapped to language specific conversion step in QIR abstraction layers (right).

architecture

Contributing

Citation

If you use qBraid-QIR in your research, we kindly request that you cite it appropriately. The BibTeX entry below is aligned with the latest stable release. For the most up-to-date citation details, please refer to CITATION.cff.

@software{Gupta_qBraid-QIR_Python_package_2026,
  author = {Gupta, Harshit and Hill, Ryan James},
  license = {Apache-2.0},
  month = feb,
  title = {{qBraid-QIR: Python package for QIR conversions, integrations, and utilities.}},
  url = {https://github.com/qBraid/qbraid-qir},
  version = {0.5.1},
  year = {2026}
}

Acknowledgements

This project was conceived in cooperation with the Quantum Open Source Foundation (QOSF).

License

Apache-2.0 License

Project details


Download files

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

Source Distribution

qbraid_qir-0.5.1.tar.gz (198.4 kB view details)

Uploaded Source

Built Distribution

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

qbraid_qir-0.5.1-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file qbraid_qir-0.5.1.tar.gz.

File metadata

  • Download URL: qbraid_qir-0.5.1.tar.gz
  • Upload date:
  • Size: 198.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qbraid_qir-0.5.1.tar.gz
Algorithm Hash digest
SHA256 9e58d12c32c0c9e869a1694accfe3f44e2a5d625c4fcf66bdc9b3d7d0e82e58d
MD5 748f077a039190cd1ea3018c060c5f29
BLAKE2b-256 ded3018f339bed9c2605196777e1736a0893953e9ce5c2e26cdcb104adfd303a

See more details on using hashes here.

File details

Details for the file qbraid_qir-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: qbraid_qir-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for qbraid_qir-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 985a38af8ae7a5cde7571c063f2f46c8f37c13f6989a3e0bb4014e138c54120c
MD5 68f34da7f53db64e263a035c8b5c9bd7
BLAKE2b-256 eacd8a22099420e8bb2e915d60e44764fc21a4f9be4ba0638901611f8462780f

See more details on using hashes here.

Supported by

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