Welcome to the docs!¶
ucc
: Unitary Compiler Collection¶
The Unitary Compiler Collection (UCC) is a Python library for frontend-agnostic, high performance compilation of quantum circuits. UCC’s goal is to gather together the best of open source compilation to make quantum programming simpler, faster, and more scalable.
By leveraging qBraid, UCC interfaces automatically with multiple quantum computing frameworks, including Qiskit, Cirq, and PyTKET and supports programs in OpenQASM 2 and OpenQASM 3. For a full list of the latest supported interfaces, just call ucc.supported_circuit_formats
.
Want to know more?
Check out our documentation, which you can build locally after installation by running
make html
inucc/docs/source
.Read the launch announcement to learn more on the current state of UCC, its capabilities and future direction.
For code, repo, or theory questions, especially those requiring more detailed responses, submit a Discussion.
For casual or time sensitive questions, chat with us on Discord.
Quickstart¶
Installation¶
Note: UCC requires Python version ≥ 3.12.
For normal users of UCC
, you can install via pip
as
pip install ucc
If developing, including if building custom transpiler passes, please install uv, which is used to managed dependencies and ensure a reproducible development enviroment. Once uv is installed, setup your development environment via
git clone https://github.com/unitaryfoundation/ucc.git
cd ucc
uv sync --all-extras --all-groups
This uv sync
command ensures the optional developer and documentation dependences are installed. For development with uv, we assume you either prefix each command with uv run
, or
you first activate the uv managed virtual environment by running source .venv/bin/activate
in your shell.
For more details on using uv, refer to its documentation or this tutorial.
Example with Qiskit, Cirq, and PyTKET¶
Define a circuit with your preferred quantum SDK and compile it!
from ucc import compile
from pytket import Circuit as TketCircuit
from cirq import Circuit as CirqCircuit
from qiskit import QuantumCircuit as QiskitCircuit
from cirq import H, CNOT, LineQubit
def test_tket_compile():
circuit = TketCircuit(2)
circuit.H(0)
circuit.CX(0, 1)
compile(circuit)
def test_qiskit_compile():
circuit = QiskitCircuit(2)
circuit.h(0)
circuit.cx(0, 1)
compile(circuit)
def test_cirq_compile():
qubits = LineQubit.range(2)
circuit = CirqCircuit(
H(qubits[0]),
CNOT(qubits[0], qubits[1]))
compile(circuit)
Contributing¶
We’re building UCC as a community-driven project. Your contributions help improve the tool for everyone! There are many ways you can contribute, such as
Create a Custom Compiler Pass: Learn how in the User Guide
Submit a bug report or feature request: Submit a bug report or feature request on GitHub.
Contribute Code: Follow the Contribution Guide to submit new passes and improvements.
If you have questions about contributing please ask on the Unitary Foundation Discord.
License¶
UCC is distributed under GNU Affero General Public License version 3.0(AGPLv3). Parts of ucc contain code or modified code that is part of Qiskit or Qiskit Benchpress, which are distributed under the Apache 2.0 license.