QiliSDK is a Python framework for writing digital and analog quantum algorithms and executing them across multiple quantum backends. Its modular design streamlines the development process and enables easy integration with a variety of quantum platforms.
Project description
QiliSDK
QiliSDK is an open-source Python framework for designing and executing analog, digital, and hybrid quantum algorithms. Its modular structure unifies circuit-based and Hamiltonian-based workflows within a single API. It provides high-level abstractions for gates, circuits, Hamiltonians, and more, while remaining fully backend-agnostic allowing a seamless switch between CPU, GPU, or QPU execution. Fast CPU simulation can be done locally using QiliSim, our quantum simulator written in C++.
Installation
QiliSDK is available via PyPI:
pip install qilisdk
For other installaton options, see the docs.
Usage
Here are just a few examples to get you started, for tutorials and full documentation, please see the docs.
Digital Circuits
To create a simple quantum circuit:
from qilisdk.digital import Circuit, H, RX, CNOT
circuit = Circuit(2) # Create a circuit with 2 qubits
circuit.add(H(0)) # Apply Hadamard on qubit 0
circuit.add(RX(1, theta=3.14)) # Apply RX rotation on qubit 1
circuit.add(CNOT(0, 1)) # Add a CNOT gate between qubit 0 and 1
Analog Evolution
To create a linear interpolation between an initial and final Hamiltonian:
from qilisdk.analog import Schedule, X, Z
initial_hamiltonian = - X(0) - X(1)
final_hamiltonian = Z(0) + Z(1) + 0.5 * Z(0) * Z(1)
schedule = Schedule.linear(initial_hamiltonian, final_hamiltonian, total_time=10.0, dt=0.5)
Development Guide
This section covers how to set up a local development environment for qilisdk, run tests, enforce code style, manage dependencies, and contribute to the project. We use a number of tools to maintain code quality and consistency:
- uv for dependency management and packaging.
- ruff for linting and code formatting.
- ty for language server and static type checking.
- towncrier for automated changelog generation.
Setup & Dependency Management
For instructions on how to compile from source and set up the development environment, see the docs. Following those instructions will setup a virtual environment (venv) in which you can run all other development tools (e.g. tests, linting).
Testing
We use pytest for the test suite. Once you have your venv set up, run the Python unit tests using:
pytest tests/unit_python
To run the integration tests (bigger tests which use the full QiliSDK stack and might take a bit longer):
pytest tests/integration
To run the CUDA, qutip, and SpeQtrum backend tests, install the optional extras first (e.g., uv sync --all-groups --extra all-cu13).
To run the C++ tests, you first need to recompile with C++ testing enabled:
uv sync --reinstall -Ccmake.define.tests=ON
The C++ testing suite can then be ran using:
./tests/unit_cpp/test_cpp
Linting & Formatting
We enforce code style and best practices using ruff. ruff handles:
- Lint checks (similar to flake8, pylint).
- Formatting (similar to black or isort).
- Automated fixes for certain issues.
To check linting:
ruff check
To automatically fix lint issues (where possible):
ruff check --fix
To automatically format your code:
ruff format
(We recommend running ruff check --fix and ruff format before committing any changes.)
To check the C++ code, compile with the tidy flag:
uv pip install -v -e ./ -Ccmake.build-type=Debug -Ccmake.define.tidy=ON
This will run clang-tidy as well as a number of C++ compiler flags for debugging. For this you will need clang-tidy installed, which can be done on Debian/Ubuntu with:
sudo apt-get install clang-tidy
It may also throw an error about not being able to find omp.h, if so, try:
sudo apt-get install libomp-dev
For ease of use there are also a number of bash scripts in the "scripts" folder, for instance to generate coverage reports or to run all pre-commit checks.
Type Checking
We use ty for static type checking. This helps ensure our code is type-safe and maintainable.
ty check
(We encourage developers to annotate new functions, classes, and methods with type hints.)
Helpful Scripts
For ease of use there are also a number of scripts in the scripts/ directory. Each of these generates a .log file with the same name as the script (checks.sh generates checks.log and so on).
To run all pre-commit checks (e.g. linting/tests):
bash scripts/checks.sh
To check all of the code blocks in the documentaton:
bash scripts/docs.sh
To generate a full coverage report of all code, run:
bash scripts/cov.sh
This will generate a html file which you can open in your browser to see which lines (in both the C++ and Python) are covered by the tests. We aim for 100% coverage!
Changelog Management
We manage our changelog using towncrier. Instead of editing CHANGELOG.md directly, each pull request includes a small news fragment file in the changes/ directory describing the user-facing changes.
For example, if you create a PR with id #123 adding a new feature, you add:
changes/123.feature.rst
Inside this file, you briefly describe the new feature:
Added a new `cool_feature` in the `qilisdk.backends` module.
Instead of manually creating the file, you can run:
towncrier create --no-edit
When we cut a new release, we update the version in pyproject.toml file and run:
towncrier
This aggregates all the news fragments into the CHANGELOG.md under the new version and removes the used fragments.
Contributing
We welcome contributions! Here’s the workflow:
- Fork this repository and create a feature branch.
- Write your changes (code, docs, or tests).
- Add a news fragment (if applicable) in
changes/describing the user-facing impact. - Run the following checks locally:
ruff check --fix ruff format ty check pytest tests
- Commit and push your branch to your fork.
pre-commitwill also run the checks automatically. - Open a Pull Request against the
mainbranch here.
Our CI will run tests, linting, and type checks. Please make sure your branch passes these checks before requesting a review.
License
This project is licensed under the Apache License.
Acknowledgments
- Thanks to all the contributors who help develop qilisdk!
- uv for making dependency management smoother.
- ruff, ty, and towncrier for their amazing tooling.
Feel free to open issues or pull requests if you have questions or contributions. Happy quantum coding!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qilisdk-0.2.0.tar.gz.
File metadata
- Download URL: qilisdk-0.2.0.tar.gz
- Upload date:
- Size: 590.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d7d2741a45eb3d3510632730a4a9613b9fc2624abdc7eec440bbca1fb05f56b
|
|
| MD5 |
0283cefb2373aab4a4ad260e3a8756f2
|
|
| BLAKE2b-256 |
b4aa3477e2f06127ab8714b97a070797db0dd53186e4dc25b9fb49519726b0fe
|
File details
Details for the file qilisdk-0.2.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee48d03cee1e45c5936a95f506f0af872626b1c8607512cc54acb574ccca3995
|
|
| MD5 |
61526437218386bb98b4d0787e8038eb
|
|
| BLAKE2b-256 |
dfa4c661be0859f18e6b43e6c60adb757952a7d22cf8f4ba65dacc636d682228
|
File details
Details for the file qilisdk-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e21e0ff7b0fbe8f8aa52445dcfa9a785d957fd66955b9899a5d3faabde8d7b
|
|
| MD5 |
83abb15b6b46551dddcbbe19b5331313
|
|
| BLAKE2b-256 |
1ef81f60a3bb8f64be3ed6d18e9a2d06a0c0319190e09ec2133f9be3e1403213
|
File details
Details for the file qilisdk-0.2.0-cp313-cp313-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp313-cp313-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c87aa9f163bf9f5dfac82b2a135f29c45202c554cac29da57c1d97233c227c84
|
|
| MD5 |
ac4d0a38f5d9fb50b704a9d20b4ff148
|
|
| BLAKE2b-256 |
5aed68aad6abbd8a468c80c2e9e20f86b3819daafaf7feab96b3184ddf5b8c62
|
File details
Details for the file qilisdk-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
225e18400fef079736faeacbdf2190f4fa96fd2bcc02508319eac9dc1b52454d
|
|
| MD5 |
f1486b288a6e6dfe956cbd56fe3c715b
|
|
| BLAKE2b-256 |
6be4483040e756ffee758eedf101b55521c6d0114a0d362ac8fbd38c8496ae52
|
File details
Details for the file qilisdk-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp313-cp313-macosx_10_13_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.13, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23e88a98211741fc7892c9ea0cfa547620d47e446b4929cb6bfab1d28253527f
|
|
| MD5 |
8ff1d1c248cdd9288495f9addc917bda
|
|
| BLAKE2b-256 |
63715099b86fbffa08026a1efbe18a3c7ee00437b09e4fded58cdad7c9660a43
|
File details
Details for the file qilisdk-0.2.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105fafd44fc463f750d8e0df0ad4a00b0ff49a12e71dd221513087c3305d6e4c
|
|
| MD5 |
af458b6b93a65cf3d3cbf2a26d3a41af
|
|
| BLAKE2b-256 |
5dc466a71476739a787f8924d591a5732cd3f73c9ff8525ea548733446c219f1
|
File details
Details for the file qilisdk-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceff4cc39abcda17d43886043a33db7bb96f754f083d7e3fe9a79502d6712d5c
|
|
| MD5 |
c394ca7fdbf39c5e5a4763ad138f14e1
|
|
| BLAKE2b-256 |
7b2003f4ce2a610c3d00db42e2776e5e3c45d2ccac51e188fa90e5f916501a9d
|
File details
Details for the file qilisdk-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b831d5167aebc7fa2a984afc7f0e496c408872f0adb988a494e0f699e5a0b62
|
|
| MD5 |
833617d5c208fd3aa6fcc0b47d960dfa
|
|
| BLAKE2b-256 |
641cd9a189c4814e34a9d277df146da5e5bea91bc22aa6347d22a26c3ffb39d0
|
File details
Details for the file qilisdk-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7d4709ab4da6cf0426192f8341d783de44ec2248be123f97f1dff9be0219b64
|
|
| MD5 |
abb74697c11aeba0a5d03dd3704aeb15
|
|
| BLAKE2b-256 |
0e9153ef311a0274f793122aa643c6d63da2b856ddc75d591efff8ca826ba702
|
File details
Details for the file qilisdk-0.2.0-cp312-cp312-macosx_10_9_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp312-cp312-macosx_10_9_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.12, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79ecab3f6932e0ffc381effdc29d9d57567f0c5c397a84a4c06a82311c9c2f4b
|
|
| MD5 |
55aed2316460a4e463e93001f88755d3
|
|
| BLAKE2b-256 |
a085273740f644bd9f57738c9feb2d9e443de52b2a243122fd4df032e0197a32
|
File details
Details for the file qilisdk-0.2.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 3.6 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
534c16777c58e78be82dc714dcd33585952d284a0bb834ee0eef66322a27f8aa
|
|
| MD5 |
7626f4f273ffb027de18791fa5389b4c
|
|
| BLAKE2b-256 |
92f1797a5e56b2ce9dfeeafdf487bcc09bca58c3a11b086ae9c7f2a7cf01c6b5
|
File details
Details for the file qilisdk-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.5 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76b06f209cdb947d77280887bb88e0b0839bb28af3516b25a53112eebf88852e
|
|
| MD5 |
9963efd5685695334cc850c3329f72c1
|
|
| BLAKE2b-256 |
ed89066e018555806524de83a81aa5380adef5163bf3225e7a521ffa339ecd13
|
File details
Details for the file qilisdk-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2ecb9996af1de186c68b1049fd05c66e7980025008745a6fd97a3730c9acf7f
|
|
| MD5 |
4080b7474433626c5f69bf8d1e00d453
|
|
| BLAKE2b-256 |
3be64b5e33042c13f5d5566661aa2c0ac5d68d5814eca1430f5756eedadea6ee
|
File details
Details for the file qilisdk-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0adedf0bd4c30db8c435cc7e256dc41b85093ab99202972d350341248473e24c
|
|
| MD5 |
08e1408f3221f6cb0d7db55597529442
|
|
| BLAKE2b-256 |
84f7cded3dea8395c73ea6595530cd419fcf0c1f95a988e0b827befe9867d47c
|
File details
Details for the file qilisdk-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl.
File metadata
- Download URL: qilisdk-0.2.0-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 3.3 MB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e755d09fb188d2b55e95e0a464c1a13c524b4636a216678108a682b36e1a682e
|
|
| MD5 |
85c1aaa58a7ab718db5abcd70246f686
|
|
| BLAKE2b-256 |
382dc2cef7755d01086b3083511f6fab1fd2afece0445066debe71e4ad69d2d1
|