Pytket is a python module for interfacing with tket, a quantum computing toolkit and optimising compiler developed by Quantinuum.
pytket-aqt
is an extension to pytket
that allows pytket
circuits to be
executed on AQT's (Alpine Quantum Technologies') quantum devices and simulators.
See extension documentation for more.
pytket-aqt
is available for Python 3.10, 3.11 and 3.12, on Linux, MacOS
and Windows. To install, run:
pip install pytket-aqt
This will install pytket
if it isn't already installed, and add new classes
and methods into the pytket.extensions
namespace.
pytket-aqt
offers offline simulators for aqt devices that do not require special access.
Access to remote simulators and machines can be configured by providing an AQT access token.
To see which devices are available to you, use the AQTBackend.print_device_table
method.
This method will prompt for an access token if none has been configured. Providing a token at the
prompt will store it in memory for further API use. Skip the prompt to see the available offline
simulators. It is also possible to store and use your access token across sessions using
config.set_aqt_config
.
The AQTMultiZoneBackend
supports routing of a circuit to a particular segmented ion-trap architecture before submission. This feature is experimental and not necessary for any currently available AQT devices. In order to use the graph partitioning based algorithms within this context, a manual installation of the mt-kahypar package is necessary. See the instructions there for details.
Please file bugs and feature requests on the Github issue tracker.
There is also a Slack channel for discussion and support. Click here to join.
This project uses Poetry for packaging and dependency management and Nox for task automation.
Install development tools:
pip install -r dev-tool-requirements.txt
Nox can be used to automate various development tasks running in isolated python environments. The following Nox sessions are provided:
pre-commit
: run the configured pre-commit hooks within .pre-commit-config.yaml, this includes linting with black and pylintmypy
: run type checks using mypytests
: run the unit testsdocs-build
: build the documentation
To run a session use:
nox -s <session_name>
To save time, reuse the session virtual environment using the -r
option, i.e. nox -rs <session_name>
(may cause errors after a dependency update).
Pre-commit can be used to run the pre-commit hooks before each commit. This is recommended. To set up the pre-commit hooks to run automatically on each commit run:
nox -s pre-commit -- install
Afterward, the pre-configured hooks will run on all changed files in a commit and the commit will be
rejected if the hooks find errors. Some hooks will correct formatting issues automatically (but will still reject the commit, so that
the git commit
command will need to be repeated).
To install the local package, its dependencies and various development dependencies run:
poetry install --with tests,docs,mypy,pre-commit
This will install the dependencies within an isolated virtual environment managed by Poetry. To activate that environment run:
poetry shell
Within this environment, the following commands can be used:
# run tests
pytest tests
# run mypy
mypy --explicit-package-bases pytket tests docs/conf.py docs/build-docs
# run pre-commit checks
pre-commit run --all-files --show-diff-on-failure
# build documentation
./docs/build-docs
To exit the Poetry environment, run:
exit
Pull requests are welcome. To make a PR, first fork the repo, make your proposed
changes on the main
branch, and open a PR from your fork. If it passes
tests and is accepted after review, it will be merged in.
All code will be checked on the CI with black and pylint
as configured within the pre-commit
checks. These checks should be
run locally before any pull request submission using the corresponding nox
session or pre-commit
directly (see above).
The used versions of the formatting ad linting tools is specified in the pyproject.toml.
On the CI, mypy is used as a static
type checker and all submissions must pass its checks. You should therefore run
mypy
locally on any changed files before submitting a PR. This should be done using the method
described under Local development with Nox or without Nox.
When adding a new feature, please add appropriate tests for it within the tests directory. When fixing a bug, please add a test that demonstrates the fix.