qodec: Python bindings
Python bindings for the Rust qodec model. See the usage and API documentation, the shared model, and the YAML representation.
Build and install from source
Use Python 3.11 or newer, a Rust toolchain, and a C compiler/linker. Start in the
qodec directory inside a
qdk-ec source checkout,
the folder containing qodec's Cargo.toml, examples/, and tools/.
Activate the Python environment you intend to use, then run:
python -m pip install maturin
cd bindings/python
python -m maturin develop --release --extras parsers
cd ../..
The optional parsers extra currently installs Stim. Omit --extras parsers
when working only with YAML or a custom parser; this build does not require an
existing qodec release on PyPI. The Stim adapter registers on import when Stim
is available, so restart a running Python process after installing the extra.
Other languages supply a parser with
qodec.register(custom_parser, format="my-format"); see
Source formats.
Use circuit.calls(parser=...) for a one-call override.
This is an editable development installation. To check a regular installation, build a wheel and install it into a separate environment:
python -m maturin build --release --manifest-path bindings/python/Cargo.toml --out target/wheels
python tools/check_wheel.py target/wheels
Use an output directory containing only the wheel you intend to test. The check creates a temporary environment, installs the wheel without optional dependencies, and checks imports and a load/save round trip outside the checkout. It runs on Windows, macOS, and Linux. The wheel installs the model, not the repository's examples or the QDK audit engine. The project README explains how to obtain example data outside a checkout.
Build and test the documentation
The .pyi files
are canonical for Python signatures and API
prose. Sphinx AutoAPI reads them to generate the API pages; edit the stubs,
not the generated pages.
Documentation requires Python 3.11 or newer, the installed bindings, and the
parsers extra for circuit examples. From the qodec directory, in that environment:
python -m pip install -r bindings/python/docs/requirements.txt
python -m sphinx -W --keep-going -b html bindings/python/docs target/python-docs/html
python -m sphinx -W --keep-going -b doctest bindings/python/docs target/python-docs/doctest
python bindings/python/docs/test_docs.py
Open target/python-docs/html/index.html for the built documentation. See
Contributing for shared documentation
guidelines.
Release files for qodec 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qodec-0.2.0.tar.gz | 429.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| qodec-0.2.0-cp311-abi3-win_arm64.whl | CPython 3.11 | abi3 | Windows ARM64 | Details |
| qodec-0.2.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| qodec-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| qodec-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| qodec-0.2.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| qodec-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 9.0 MB
Release files / qodec-0.2.0.tar.gz
| Download URL | qodec-0.2.0.tar.gz |
|---|---|
| Size | 429.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
800e95a55abfcb6e464d394af879c22cf91146f392e099087de5fdd7d5678629
|
|
BLAKE2b-256 checksum How to use checksums |
eebb83b00775aa669701c724f290accc979c9ee8ea3fd71da62d220d0ff80064
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-win_arm64.whl
| Download URL | qodec-0.2.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
58e0e259777dc1287eb2f2545fffdaa56973357708f27e376e6c6b2f054c0647
|
|
BLAKE2b-256 checksum How to use checksums |
4d15ccb7dc8f0b44c061c20fdf47be1f5ec586cb83aeccdd35aca93e5af5ab6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-win_amd64.whl
| Download URL | qodec-0.2.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c5ed1631aa236edcd5221b4fba0f780a937932a996ca852efd32b3e04041e1a9
|
|
BLAKE2b-256 checksum How to use checksums |
48a62afb595e39b6c72c48eebcda4313d15a09d1a67c145528c19ae39a8f32c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
| Download URL | qodec-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7eafd2d591129a10b80ac28e197457c9d5d3683fa60a3478cda4cf54a6274d63
|
|
BLAKE2b-256 checksum How to use checksums |
8e11fbef7ddfeafebd3d921d3b87596ca85caa619856348a658b3dc088355dcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl
| Download URL | qodec-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
58aa73b4c0114f258c6d9ccebd3c1082da07a7361ae697d6eee6b14efeadc223
|
|
BLAKE2b-256 checksum How to use checksums |
93ddb7528b11dd96fc7e60d98f2c553889a3606cc8b71448a5744137c060b03e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | qodec-0.2.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4259e1383c9d7c7bcf9f96cdfb933144ea00c4f7bd4fa4d8c057f2d8e4fe2ded
|
|
BLAKE2b-256 checksum How to use checksums |
7950150f22e446745ff2856c952375698896f4a926cf620569a1f0944c53bcb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qodec-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | qodec-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f6fdb58370f1d86dfeef63c778e43c7fbc1c4f6992ffa878dca67a6d76ae2094
|
|
BLAKE2b-256 checksum How to use checksums |
b10f6ac9c9fb5bad5e67431d01fa90410be741dcd9df3e599f7fa3c99cd361c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|