Skip to main content

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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qodec 0.1.0
File Size Uploaded
qodec-0.1.0.tar.gz 422.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for qodec 0.1.0
File
qodec-0.1.0-cp311-abi3-win_arm64.whl CPython 3.11 abi3 Windows ARM64 Details
qodec-0.1.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
qodec-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
qodec-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
qodec-0.1.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
qodec-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 8.9 MB

Release files / qodec-0.1.0.tar.gz

Download URL qodec-0.1.0.tar.gz
Size 422.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b31a7c4dd311e7b5d80161b6f0a742ec3433d11121838c961d2deb303addc671
BLAKE2b-256 checksum
How to use checksums
a145f0c9872fc1cb99540263b43339ab1bfb2819c977f108f7f04f4202ffb7e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-win_arm64.whl

Download URL qodec-0.1.0-cp311-abi3-win_arm64.whl
Size 1.5 MB
Tags CPython 3.11 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
1be41b7a5fc0c048a9ae7d4303d4591c3b866976a334a688cbe989ba098f0efb
BLAKE2b-256 checksum
How to use checksums
9141d035489b3510edac5e28c37e02af18252552eabe864886a5d453f10f3fb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-win_amd64.whl

Download URL qodec-0.1.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
9fe636bf3a032df1484f9467bc61718e6793bb26af68d7c5961557230312b06e
BLAKE2b-256 checksum
How to use checksums
d2da8502353ada826fb7193a67edfe81e2601fddce38486754e91ce6c88bad84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL qodec-0.1.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
1e63540678db750bf22b63f80fbe68cdaf234e0599314d17417d9c74a82fd2d6
BLAKE2b-256 checksum
How to use checksums
96e90220de25a08a608e8d5cbb66e2524f690cfbe9bf08b09f70f7ad13c8a453
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL qodec-0.1.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
a279df9827805966c64c5e3cdad407206c204f680894d826256d7ee9f3ab53fc
BLAKE2b-256 checksum
How to use checksums
f4350762827064fe843890907695bc77813f55de8a2248b19e9af5a21487f47b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL qodec-0.1.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
520f3aad028723991e3e474dc33755c98734c20aa2d830c42781452bf0ed1996
BLAKE2b-256 checksum
How to use checksums
082886ad69c217c19bb0e8ae260ba48ba286568aeee9d1b21e937ef3df6c37d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / qodec-0.1.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL qodec-0.1.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
161d825c75bb9b8e9677b23211e7e03f40ffe45829aafbdbeabcf49269bb71da
BLAKE2b-256 checksum
How to use checksums
08a83b52fd6bb7c5f282c02f2e2a17ed9065cd1d8b0a6e784c64b2aaf28b92dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release history Release notifications | RSS feed

0.2.1

19 release files

0.2.0

7 release files

This release

0.1.0 This release

7 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page