pytket (TKET)
A compiler-first toolkit that optimises circuits and moves them between other frameworks and hardware.
by Quantinuum · Python (with a C++ compiler core) · Moderate · Open source Python package (Apache 2.0 per its repository; check) · reviewed December 2026
What it is
TKET is a quantum compiler from Quantinuum, and pytket is its Python interface. You can build circuits in pytket itself or import them from other frameworks, compile them with optimisation passes, and send them to a device through an extension package.
It is best seen as the glue and the optimiser. Many people use it together with Qiskit or Cirq rather than instead of them.
- Compilation is the main event, with many composable passes.
- Circuits move freely between tools through extension packages.
- Backends are an abstraction, so the same circuit can target many devices.
Core ideas
- Circuit
- A pytket circuit with chained methods such as H, CX and measure_all.
- Passes
- Compilation steps, for example peephole optimisation and routing.
- Backend
- An object that compiles for and runs on a simulator or device.
- Extensions
- Separate packages that connect pytket to Qiskit, Cirq, PennyLane, Braket and Quantinuum systems.
Install and first program
Install
pip install pytket pip install pytket-qiskit # for the Aer backend
Bell state
from pytket import Circuit from pytket.extensions.qiskit import AerBackend circ = Circuit(2).H(0).CX(0, 1).measure_all() backend = AerBackend() compiled = backend.get_compiled_circuit(circ) result = backend.run_circuit(compiled, n_shots=1000) print(result.get_counts()) # about half (0, 0) and half (1, 1)
Counts use tuples of bits as keys. Not executed in this site’s build environment; check the current pytket documentation.
Optimising a circuit
from pytket import Circuit from pytket.passes import FullPeepholeOptimise circ = Circuit(2).H(0).H(0).CX(0, 1).CX(0, 1).H(1) print(circ.n_gates) # 5 gates before FullPeepholeOptimise().apply(circ) print(circ.n_gates) # fewer gates after
Two Hadamards in a row and two identical CNOTs in a row cancel, so a good optimiser removes four of the five gates. The exact count printed can depend on the pass and version.
Strengths
- →Strong circuit optimisation and routing
- →Converts between other frameworks’ circuits
- →One backend interface for many devices
- →Documentation maintained by the vendor
- →Helpful when benchmarking compilers
Weaknesses
- →Smaller user community
- →Fewer beginner tutorials
- →Needs extension packages for most backends
- →Some features are tied to Quantinuum’s systems
Hardware access
Backends are provided by extension packages, so the available hardware is the union of what those extensions support. Quantinuum systems have a dedicated extension. Check each extension’s documentation.
Ecosystem
- Extensions for Qiskit, Cirq, PennyLane and Braket
- pytket-quantinuum for Quantinuum systems
- Documentation for the TKET compiler
- A user manual with worked examples
Choose it when
- Optimising and routing circuits
- Moving circuits between frameworks
- Comparing compilers
- Targeting Quantinuum systems
Look elsewhere when
- First-time learners
- Machine-learning workflows
Common pitfalls
- Install the extension for the backend you want. The core package does not include them.
- Pytket uses its own qubit register objects, which can differ from other frameworks’ indexing.
- Compilation must match the target device’s gate set, so use the backend’s own compile method.
- Documentation moved to a new site, so older links may be out of date.
A learning path
- Install pytket and build the Bell circuit.
- Apply an optimisation pass and compare gate counts.
- Install pytket-qiskit and run on a simulator.
- Convert a circuit from another framework.
Ratings
Editorial ratings from 0 to 3, not benchmarks.
| Beginner friendliness | 1 | |
| Quantum machine learning | 0 | |
| IBM hardware | 2 | |
| Google hardware | 1 | |
| Many hardware providers | 3 | |
| GPU simulation | 0 | |
| Circuit compilation | 3 | |
| Fault-tolerant planning | 1 | |
| Low-level control | 2 |
Compared with others
Learn more on QuantumAtlas
Questions
Is pytket a replacement for Qiskit?
Usually not. It is often used alongside Qiskit or Cirq to compile and to move circuits between tools.
Do I need a Quantinuum account?
Only to run on Quantinuum systems. Simulators work without one.
What is TKET?
The compiler at the core of pytket. pytket is the Python interface.
Sources
Frameworks change often. The official documentation is the final word on versions, devices and prices.