Skip to main content

QCC: the Quantum Compiler Collection

A technology-agnostic quantum circuit compiler, part of the Qevedo packages: it installs as qevedo-compiler and imports as qevedo.compiler.

Install

pip install qevedo-compiler

For development, from a checkout (this builds the Rust core, so it needs a Rust toolchain, from https://rustup.rs):

cd qcc/python
pip install -e ".[dev]"            # or: maturin develop --release

The Rust core lives in ../core (cargo test --release there runs its own tests); src/ holds its Python bindings.

openqasm 3.x is installed from PyPI. To develop both together, also install the sibling checkout: pip install -e ../../openqasm.

Usage

qcc compile examples/bell.qasm -o /tmp/out.qasm --device qevedo/compiler/profiles/all_to_all.yaml
qcc compile program.qasm -o /tmp/out.qasm --qasm-version 3 -I lib/

From Python:

from qevedo.compiler import compile_source, emit_qasm

circuit = compile_source(open("examples/bell.qasm").read())
print(emit_qasm(circuit))

The reference device profiles ship with the package, in qevedo/compiler/profiles/.

Input can be OpenQASM 2 or 3. Programs are checked by openqasm.analyze before lowering, so errors are reported with their location. The frontend supports qubit and bit registers, gate calls with constant parameters (broadcast over registers), measurements, resets, barriers, let aliases of qubits and const values. Control flow, gate modifiers, classical variables, timing and hardware qubits are rejected with an error until the IR supports them. Gates defined by the program (or its own include files) are expanded into their bodies; gates from qelib1.inc and stdgates.inc stay named so the compiler can lower them optimally.

Lowering to native gates

compile_source and compile_file rewrite every gate into the device profile's native_gates, with the fewest gates:

  • single-qubit gates through an Euler decomposition into the device's single-qubit basis (rz+sx, rz+rx, rz+ry, rx+ry or u3);
  • two-qubit gates through a KAK decomposition into the device's two-qubit gate (cx, cz, cy, ch, ecr, rxx, ryy, rzz or rzx), using the minimal number of two-qubit gates (at most 3; on a cx device, 1 for cz, 2 for crz and 3 for swap);
  • standard gates with a shorter textbook definition, and gates on three or more qubits, through their definitions.

After lowering, the circuit is optimized: single-qubit runs are merged, gates cancel or merge across gates they commute with, and every run of gates on one pair of qubits is resynthesized as a single two-qubit unitary when that is cheaper. On a 12-qubit QFT and Qiskit's random circuits this gives the same CX counts as Qiskit's optimization_level=3 and equal or lower total gate counts (see docs/ARCHITECTURE.md).

from qevedo.compiler import CompileOptions, compile_source
from qevedo.compiler.device import DeviceSpec

ion_trap = DeviceSpec(name="ions", topology="all_to_all", qubits=4,
                      native_gates={"rx", "ry", "rxx"})
circuit = compile_source(open("program.qasm").read(), CompileOptions(device=ion_trap))
print(circuit.gate_counts())

Multi-core architectures

qevedo.compiler.multicore compiles circuits for modular quantum computers made of several cores joined by quantum links, in Rust:

  • mapping: before each timeslice, which core every qubit is in, with as few teleportations as possible: Hungarian Qubit Assignment (HQA, Escofet et al.), FGP-rOEE and a naive mapper, on cores linked all to all, in a line, a ring, a grid or any connected way;
  • routing inside the cores (map_and_route): each core routed on its own coupling graph with SABRE, giving a circuit on physical qubits with SWAPs and teleportations, optionally through fixed communication qubits (ports);
  • timing: how long the circuit takes when links make EPR pairs a few at a time, and "hqa-latency", an HQA that plans for it.
from qevedo.compiler.multicore import Timing, map_and_route, map_to_cores

mapping = map_to_cores(open("circuit.qasm").read(), cores=4, qubits_per_core=10)
print(mapping.communications)            # teleportations

result = map_and_route(open("circuit.qasm").read(), cores=4, qubits_per_core=9,
                       chip="grid:3x3", topology="line", ports="central",
                       method="hqa-latency", timing=Timing(link_capacity=2))
print(result.teleportations, result.swaps, result.schedule().duration)

It reproduces Escofet et al.'s comparison (HQA needs 1.24× fewer teleportations than FGP-rOEE), and on TeleSABRE's own device and circuits, HQA with ports uses 0.26× its EPR pairs and 0.51× its SWAPs. See docs/MULTICORE.md for the model, the methods and every benchmark.

Tests

pytest

Metadata

Release files for qevedo-compiler 0.2.0

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

Source distribution (sdist)

Source distribution for qevedo-compiler 0.2.0
File Size Uploaded
qevedo_compiler-0.2.0.tar.gz 136.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for qevedo-compiler 0.2.0
File
qevedo_compiler-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details
qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details
qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details
qevedo_compiler-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details
qevedo_compiler-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details

Total release size: 2.7 MB

Release files / qevedo_compiler-0.2.0.tar.gz

Download URL qevedo_compiler-0.2.0.tar.gz
Size 136.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fe27505ea281fa48b69dfbf7479a6e0dc963e7a94ad4db470755c6bfc0244331
BLAKE2b-256 checksum
How to use checksums
5ff1266b025171f5cd353c5de4bc8fc4c2cbe6389bc116775f0df74d8eb7673c
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 16, 2026.

Transparency log

Release files / qevedo_compiler-0.2.0-cp310-abi3-win_amd64.whl

Download URL qevedo_compiler-0.2.0-cp310-abi3-win_amd64.whl
Size 452.7 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a0204ce79a7930628ed156c99e51339b0ccf6c5c01dcc553a28c4dd6413b2085
BLAKE2b-256 checksum
How to use checksums
9bcb3abb718ad677e3823a415ce7f9a265f0370e3889bada50b8f2e636bcdeb8
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 16, 2026.

Transparency log

Release files / qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 552.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fea7378858004b20b813f10fd6723b8ddff52827cbd80261b252b37c7b069e57
BLAKE2b-256 checksum
How to use checksums
31f7e865097fdc6d802aeffe0ac3f4e620c1b4322aa5050b4e946d73b06967dd
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 16, 2026.

Transparency log

Release files / qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL qevedo_compiler-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 530.5 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
248f40f6a03d81ba7ad43766f11528ed9110a9ce4389f90c58d85045ad9dedbc
BLAKE2b-256 checksum
How to use checksums
767b008c082cf31f90d0d8ae6f8bd0f596f6d9aee7b65abdc1904bb0be26db13
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 16, 2026.

Transparency log

Release files / qevedo_compiler-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL qevedo_compiler-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 502.1 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
5504376a7090430f5f8776f44e190649f7cc9387b8ed4e092ceda832ae9eef86
BLAKE2b-256 checksum
How to use checksums
327e68686198d087b60725a67605ab8771d092e433c291f037f744080e859ef4
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 16, 2026.

Transparency log

Release files / qevedo_compiler-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL qevedo_compiler-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 526.2 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a6af282486f09db8487c32d74b06c5a4dfe2b0087f99f691051a62e83dc47081
BLAKE2b-256 checksum
How to use checksums
b33b53fc3efb8b3ba514ee871cbab156585a54a937b07f9247292b394c833e55
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 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files

0.1.1

2 release files

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