pytket

Source code for the TKET quantum compiler, Python bindings and utilities

https://github.com/cqcl/tket

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.2%) to scientific vocabulary

Keywords

compiler quantum-computing

Keywords from Contributors

interactive graph-theory error-mitigation quantum-error-mitigation quantum-programming parallel mesh interpretability sequences generic
Last synced: 6 months ago · JSON representation

Repository

Source code for the TKET quantum compiler, Python bindings and utilities

Basic Info
Statistics
  • Stars: 284
  • Watchers: 21
  • Forks: 50
  • Open Issues: 83
  • Releases: 202
Topics
compiler quantum-computing
Created over 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Citation

README.md

tket

Slack Stack Exchange PyPI version

Introduction

TKET (pronounced "ticket") is a high-performance quantum compiler that can optimise circuits for a wide range of quantum computing architectures.

This repository contains the full source code for TKET and its python bindings.

The standard way of using TKET is via its pytket python API.

If you just want to use TKET via Python, the easiest way is to install pytket with pip:

shell pip install pytket

As well as being an interface to the TKET compiler, pytket also provides an extensive API for other quantum computing tasks. These include constructing quantum circuits and handling the execution of experiments on devices and simulators.

Documentation

The tket (C++) API documentation (generated with doxygen, and still rather patchy) is available here.

The pytket (Python) API documentation is available here.

For getting started using pytket, check out the user manual and notebook examples.

The source content for the manual and notebook examples can be found in the pytket-docs repository.

Extensions

In addition to the core pytket package there are pytket extension modules which allow pytket to interface with quantum devices and simulators. Some extensions also provide interoperability with other software libraries such as qiskit, cirq and pennylane.

For a list of available pytket extensions see the extensions index page.

These extensions are installed as separate python packages and the source code for each extension lives in its own github repository.

How to build TKET and pytket

If you would like to build TKET yourself and help to improve it, read on!

The codebase is split into two main projects: - tket: the core functionality of tket, optimised for execution speed and implemented in C++. - pytket: the Python interface of tket. This consists of binder modules to tket (written in C++ and making use of pybind11 to link to the tket shared library) and pure Python code that defines abstract interfaces used by the extension modules such as the Backend and BackendResult classes, as well as various other utilities.

There is further a limited subset of the C++ functionality that is exposed through a C API in the tket-c-api directory. This project is experimental, and we make no guarantees about its stability or future compatibility.

Prerequisites

Build tools

The following compiler toolchains are used to build tket on the CI and are therefore known to work:

  • Linux: gcc-13
  • MacOS: apple-clang 15
  • Windows: MSVC 19

It is recommended that you use these versions to build locally, as code may depend on the features they support. The compiler version can be controlled by setting CC and CXX in your environment (e.g. CC=gcc-11 and CXX=g++-11), or on Debian-based Linux systems using update-alternatives.

You should also have Python (3.10, 3.11, 3.12 or 3.13) and pip installed. We use cmake and the package manager conan to build tket and pytket. The latter can be installed with pip:

shell pip install conan

You will need at least cmake version 3.26, and conan version 2.

Set up conan profile

Generate a profile that matches your current machine, and add the required remote where some dependencies are stored:

shell conan profile detect conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0

Optional: use ninja and ccache

It is recommended that you also install ninja and ccache to speed up the build process. For example with apt on Debian/Ubuntu: shell apt install ninja-build ccache Homebrew on MacOS/Linux: shell brew install ninja ccache Chocolatey on Windows: shell choco install ninja ccache

On MacOS/Linux:

  • If installed, ccache is used automatically
  • ninja must either be set as the default Cmake generator using the following command: shell echo "tools.cmake.cmaketoolchain:generator = Ninja" >> $(conan config home)/global.conf or be specified on a command-by-command basis by providing the argument -c tools.cmake.cmaketoolchain:generator=Ninja to conan

On Windows: - Set ninja as generator as described above (less reliable than the default Visual Studio generator) - ccache will be used automatically only when using Ninja or Makefile as the Cmake generator. It can also be used with Visual Studio generators by setting the environment variable TKET_VSGEN_CCACHE_EXE to the path of the ccache executable. Note: this must be the path to the actual binary, not a symlink or shim (as used by Chocolatey). If using Chocolatey to install ccache, you can find the path to the binary using ccache --shimgen-help

Building and testing the utility libraries

See the README in the libs directory for instructions on building and testing the utility libraries used by tket (for logging, random-number generation and so on). This is not necessary if you just want to build tket or pytket since the recipes or binaries will be automatically downloaded from the above conan remote.

Building and testing the tket library

See the README in the tket directory for instructions on building and testing tket as a standalone C++ library.

Building and testing pytket

See the README in the pytket directory for instructions on building and testing pytket.

Owner

  • Name: Cambridge Quantum
  • Login: CQCL
  • Kind: organization
  • Location: Cambridge, UK

Quantum Software and Technologies

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,272
  • Total Committers: 35
  • Avg Commits per committer: 36.343
  • Development Distribution Score (DDS): 0.427
Past Year
  • Commits: 277
  • Committers: 16
  • Avg Commits per committer: 17.313
  • Development Distribution Score (DDS): 0.386
Top Committers
Name Email Commits
Alec Edgington 5****c 729
yao-cqc 7****c 97
Silas Dilkes 3****s 73
cqc-melf 7****f 71
CalMacCQ 9****Q 61
dependabot[bot] 4****] 37
Luca Mondada 7****a 31
Will Simmons w****s@c****m 28
Travis Thompson 1****o 23
Agustin Borgna a****a@q****m 20
seyon s****h@c****m 17
Tiffany Duneau 3****6 16
Jake Arkinstall 6****l 11
Roland-djee 9****e 8
Fernando Betanzo Sanchez f****z@c****m 6
Roland Guichard r****d@c****m 6
Dan Mills 5****c 4
John Children 3****n 4
Aidan 1****Q 4
jpacold j****d@g****m 4
drzenharper 7****r 4
Alexander Cowtan 4****n 2
David Yonge-Mallo d****o 2
Pablo Andres-Martinez 1****Q 2
Kartik Singhal k****l@q****m 2
Dominik Schmid d****3@g****m 1
Israel Reichental 3****e 1
Monit Sharma 6****a 1
Richard Morrison 1****n 1
Thien Nguyen 5****n 1
and 5 more...
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 390
  • Total pull requests: 1,229
  • Average time to close issues: 3 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 51
  • Total pull request authors: 29
  • Average comments per issue: 1.02
  • Average comments per pull request: 0.57
  • Merged pull requests: 980
  • Bot issues: 0
  • Bot pull requests: 54
Past Year
  • Issues: 144
  • Pull requests: 488
  • Average time to close issues: 18 days
  • Average time to close pull requests: 1 day
  • Issue authors: 29
  • Pull request authors: 14
  • Average comments per issue: 0.67
  • Average comments per pull request: 0.27
  • Merged pull requests: 402
  • Bot issues: 0
  • Bot pull requests: 23
Top Authors
Issue Authors
  • cqc-alec (192)
  • CalMacCQ (32)
  • yao-cqc (31)
  • cqc-melf (22)
  • daniel-mills-cqc (16)
  • sjdilkes (11)
  • MattePalte (9)
  • IlanIwumbwe (6)
  • p51lee (6)
  • lmondada (3)
  • Bennybenassius (3)
  • willsimmons1465 (3)
  • andrew-tranter (3)
  • nquetschlich (3)
  • yoshi-qc (3)
Pull Request Authors
  • cqc-alec (649)
  • CalMacCQ (131)
  • cqc-melf (89)
  • yao-cqc (71)
  • sjdilkes (69)
  • dependabot[bot] (54)
  • willsimmons1465 (36)
  • jake-arkinstall (18)
  • trvto (18)
  • daniel-mills-cqc (14)
  • wintertimem (12)
  • DNA386 (12)
  • jpacold (8)
  • PabloAndresCQ (7)
  • lmondada (6)
Top Labels
Issue Labels
bug (95) stale (41) enhancement (19) classical-logic (12) documentation (6) dependencies (1) question (1) good first issue (1) github_actions (1)
Pull Request Labels
dependencies (54) github_actions (15) documentation (13) python (12) stale (7) enhancement (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 72,909 last-month
  • Total docker downloads: 50
  • Total dependent packages: 40
    (may contain duplicates)
  • Total dependent repositories: 48
    (may contain duplicates)
  • Total versions: 400
  • Total maintainers: 6
pypi.org: pytket

Quantum computing toolkit and interface to the TKET compiler

  • Versions: 219
  • Dependent Packages: 40
  • Dependent Repositories: 48
  • Downloads: 72,874 Last month
  • Docker Downloads: 50
Rankings
Dependent packages count: 0.4%
Downloads: 1.7%
Dependent repos count: 2.1%
Average: 3.2%
Docker downloads count: 4.3%
Stargazers count: 4.7%
Forks count: 6.3%
Last synced: 6 months ago
proxy.golang.org: github.com/cqcl/tket
  • Versions: 86
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/CQCL/tket
  • Versions: 86
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
pypi.org: pytket-offline-display

Python module for displaying pytket circuits when offline.

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 35 Last month
Rankings
Dependent packages count: 6.6%
Downloads: 12.3%
Average: 23.8%
Forks count: 30.5%
Dependent repos count: 30.6%
Stargazers count: 39.1%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/build_and_test.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • dorny/paths-filter v2.11.1 composite
  • hendrikmuhs/ccache-action v1.2.8 composite
  • josStorer/get-current-time v2.0.2 composite
  • turtlebrowser/get-conan v1.1 composite
.github/workflows/build_libs.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • dorny/paths-filter v2.11.1 composite
.github/workflows/coverage.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
  • dorny/paths-filter v2.11.1 composite
  • hendrikmuhs/ccache-action v1.2.8 composite
  • josStorer/get-current-time v2.0.2 composite
.github/workflows/docs.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
.github/workflows/issue.yml actions
  • atlassian/gajira-create v3.0.1 composite
  • atlassian/gajira-login v3.0.1 composite
.github/workflows/lint.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/packages.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • turtlebrowser/get-conan v1.1 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
  • turtlebrowser/get-conan v1.1 composite
.github/workflows/test_libs.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • dorny/paths-filter v2.11.1 composite
.github/workflows/test_libs_all.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/valgrind.yml actions
  • actions/checkout v3 composite
  • dorny/paths-filter v2.11.1 composite
  • hendrikmuhs/ccache-action v1.2.8 composite
  • josStorer/get-current-time v2.0.2 composite
  • turtlebrowser/get-conan v1.1 composite
pytket/docs/requirements.txt pypi
  • sphinx >=4.5
  • sphinx_autodoc_annotation >=1.0
  • sphinx_book_theme >=0.3
pytket/setup.py pypi
  • graphviz *
  • jinja2 *
  • lark-parser *
  • networkx *
  • numpy *
  • qwasm *
  • scipy *
  • sympy *
  • types-pkg_resources *
  • typing-extensions *
pytket/tests/requirements.txt pypi
  • autoray * test
  • docker * test
  • hypothesis * test
  • jsonschema * test
  • opt_einsum * test
  • py * test
  • pytest * test
  • pytest-benchmark * test
  • pytest-cov * test
  • quimb * test
.github/workflows/build-without-conan.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v4 composite
  • hendrikmuhs/ccache-action v1.2 composite
pyproject.toml pypi
pytket/pyproject.toml pypi
.github/workflows/build-with-nix.yml actions
  • actions/checkout v4 composite
  • cachix/install-nix-action v24 composite
pytket/tests/wasm-generation/wasmfromrust/Cargo.toml cargo
nix-support/example-flake-project/pyproject.toml pypi
  • pytket *