Metadata-Version: 2.4
Name: deltakit
Version: 0.5.0
Summary: Deltakit SDK
Author-email: Deltakit Team <deltakit@riverlane.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/riverlane/deltakit
Project-URL: Bug Tracker, https://github.com/riverlane/deltakit/issues
Project-URL: Changelog, https://github.com/riverlane/deltakit/releases
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: deltakit_circuit
Requires-Dist: deltakit_core
Requires-Dist: deltakit_decode
Requires-Dist: deltakit_explorer
Provides-Extra: tests
Requires-Dist: pytest<9,>=8.4.1; extra == "tests"
Requires-Dist: pytest-cov<7,>=6.2.1; extra == "tests"
Requires-Dist: pytest-mock<4,>=3.14.1; extra == "tests"
Requires-Dist: pytest-asyncio<2,>=1.0.0; extra == "tests"
Requires-Dist: pytest-skip-slow>=0.0.5; extra == "tests"
Requires-Dist: pytest-testmon<3,>=2.0; extra == "tests"
Requires-Dist: pytest-lazy-fixtures<2,>=1.0; extra == "tests"
Provides-Extra: lint
Requires-Dist: mypy<2,>=1.17; extra == "lint"
Requires-Dist: ruff<0.13,>=0.12.2; extra == "lint"
Requires-Dist: typos<2,>=1.34.0; extra == "lint"
Requires-Dist: isort>=6.0; extra == "lint"
Provides-Extra: docs
Requires-Dist: myst_nb<2.0,>=1.0; extra == "docs"
Requires-Dist: sphinxawesome-theme<6,>=5.3.2; extra == "docs"
Requires-Dist: sphinx-autodoc-typehints<4,>=3.0.0; extra == "docs"
Requires-Dist: sphinx-copybutton<0.6,>=0.5.2; extra == "docs"
Requires-Dist: pip-licenses>=5.0; extra == "docs"
Requires-Dist: sphinx-design<1.0,>0.6; extra == "docs"
Requires-Dist: sphinx-autobuild>=2024.10.3; extra == "docs"
Requires-Dist: myst-parser<5,>=4.0; extra == "docs"
Requires-Dist: vale>=3.12.0.0; extra == "docs"
Requires-Dist: jupytext<2,>=1.17.0; extra == "docs"
Requires-Dist: jupyter<2,>=1.1.1; extra == "docs"
Requires-Dist: ipykernel<7,>=6.29.5; extra == "docs"
Provides-Extra: build
Requires-Dist: build>=1.2.0; extra == "build"
Provides-Extra: security
Requires-Dist: bandit<2,>=1.8.6; extra == "security"
Requires-Dist: ochrona<3.0,>=2.0.2; extra == "security"
Requires-Dist: pip-audit>=2.7.3; extra == "security"
Provides-Extra: dev
Requires-Dist: pytest<9,>=8.4.1; extra == "dev"
Requires-Dist: pytest-cov<7,>=6.2.1; extra == "dev"
Requires-Dist: pytest-mock<4,>=3.14.1; extra == "dev"
Requires-Dist: pytest-asyncio<2,>=1.0.0; extra == "dev"
Requires-Dist: pytest-skip-slow>=0.0.5; extra == "dev"
Requires-Dist: pytest-testmon<3,>=2.0; extra == "dev"
Requires-Dist: pytest-lazy-fixtures<2,>=1.0; extra == "dev"
Requires-Dist: mypy<2,>=1.17; extra == "dev"
Requires-Dist: ruff<0.13,>=0.12.2; extra == "dev"
Requires-Dist: typos<2,>=1.34.0; extra == "dev"
Requires-Dist: isort>=6.0; extra == "dev"
Requires-Dist: myst_nb<2.0,>=1.0; extra == "dev"
Requires-Dist: sphinxawesome-theme<6,>=5.3.2; extra == "dev"
Requires-Dist: sphinx-autodoc-typehints<4,>=3.0.0; extra == "dev"
Requires-Dist: sphinx-copybutton<0.6,>=0.5.2; extra == "dev"
Requires-Dist: pip-licenses>=5.0; extra == "dev"
Requires-Dist: sphinx-design<1.0,>0.6; extra == "dev"
Requires-Dist: sphinx-autobuild>=2024.10.3; extra == "dev"
Requires-Dist: myst-parser<5,>=4.0; extra == "dev"
Requires-Dist: vale>=3.12.0.0; extra == "dev"
Requires-Dist: jupytext<2,>=1.17.0; extra == "dev"
Requires-Dist: jupyter<2,>=1.1.1; extra == "dev"
Requires-Dist: build>=1.2.0; extra == "dev"
Requires-Dist: bandit<2,>=1.8.6; extra == "dev"
Requires-Dist: ochrona<3.0,>=2.0.2; extra == "dev"
Requires-Dist: pip-audit>=2.7.3; extra == "dev"
Requires-Dist: pre-commit<5,>=4.2.0; extra == "dev"
Requires-Dist: ipykernel<7,>=6.29.5; extra == "dev"
Requires-Dist: validate-pyproject>=0.24.1; extra == "dev"
Requires-Dist: python-semantic-release>=10.2.0; extra == "dev"
Requires-Dist: tomlkit<1,>=0.13; extra == "dev"
Requires-Dist: deptry<1,>=0.23; extra == "dev"
Requires-Dist: ipykernel<7,>=6.29.5; extra == "dev"
Dynamic: license-file

# Deltakit

[![docs - here!][docs-badge]][docs-link]
[![PyPI][pypi-badge]][pypi-link]
[![conda-forge][conda-badge]][conda-link]
[![Python versions][python-badge]][pypi-link]
[![Pixi][pixi-badge]][pixi-link]
[![Typing][typing-badge]][typing-link]
[![License: Apache 2.0][license-badge]][license-link]
[![codecov][codecov-badge]][codecov-link]
[![SemVer][semver-badge]][semver-link]
[![SPEC 0][spec0-badge]][spec0-link]
[![Issues][issues-badge]][issues-link]
[![Discussions][discussions-badge]][discussions-link]

[docs-badge]: https://readthedocs.org/projects/deltakit/badge/?version=latest
[docs-link]: https://deltakit.readthedocs.io/en/latest/

[pypi-badge]: https://img.shields.io/pypi/v/deltakit.svg
[pypi-link]: https://pypi.org/project/deltakit/

[conda-badge]: https://img.shields.io/conda/vn/conda-forge/deltakit
[conda-link]: https://anaconda.org/conda-forge/deltakit

[python-badge]: https://img.shields.io/pypi/pyversions/deltakit

[pixi-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/prefix-dev/pixi/main/assets/badge/v0.json
[pixi-link]: https://pixi.sh

[typing-badge]: https://img.shields.io/pypi/types/deltakit
[typing-link]: https://typing.python.org/

[license-badge]: https://img.shields.io/badge/License-Apache_2.0-blue.svg
[license-link]: https://www.apache.org/licenses/LICENSE-2.0

[codecov-badge]: https://codecov.io/gh/riverlane/deltakit/branch/main/graph/badge.svg
[codecov-link]: https://codecov.io/gh/riverlane/deltakit

[semver-badge]: https://img.shields.io/badge/semver-2.0.0-blue
[semver-link]: https://semver.org/spec/v2.0.0.html

[spec0-badge]: https://img.shields.io/badge/SPEC-0-forestgreen
[spec0-link]: https://scientific-python.org/specs/spec-0000/

[issues-badge]: https://img.shields.io/github/issues/riverlane/deltakit?logo=github
[issues-link]: https://github.com/riverlane/deltakit/issues

[discussions-badge]: https://img.shields.io/badge/discussions-join-blue?logo=github
[discussions-link]: https://github.com/riverlane/deltakit/discussions

Deltakit allows you to create and run quantum error correction (QEC) experiments with features
including circuit generation, simulation, decoding and results analysis.

Whether you're a seasoned QEC researcher or just starting out, Deltakit supports you
in exploring new ways to implement QEC logic all the way to running complex
QEC circuits on QPU hardware.

## Quick Start

### Installation
Install Deltakit with `pip`.

```bash
pip install deltakit
```

### Performing a QEC experiment

`deltakit` provides a full pipeline to help you run quantum error correction experiments.

```python
from deltakit.circuit.gates import PauliBasis
from deltakit.decode import PyMatchingDecoder
from deltakit.decode.analysis import run_decoding_on_circuit
from deltakit.explorer.analysis import calculate_lep_and_lep_stddev
from deltakit.explorer.codes import RotatedPlanarCode, css_code_memory_circuit
from deltakit.explorer.qpu import QPU, ToyNoise

# Creating a noisy memory circuit with the rotated planar code
d = 3
rplanar = RotatedPlanarCode(width=d, height=d)
circuit = css_code_memory_circuit(rplanar, num_rounds=d, logical_basis=PauliBasis.Z)
qpu = QPU(circuit.qubits, noise_model=ToyNoise(p=0.01))
noisy_circuit = qpu.compile_and_add_noise_to_circuit(circuit)

# Perform simulation and correct the measured observable flips with a decoder
num_shots, batch_size = 100_000, 10_000
decoder, noisy_circuit = PyMatchingDecoder.construct_decoder_and_stim_circuit(noisy_circuit)
result = run_decoding_on_circuit(
    noisy_circuit, num_shots, decoder, batch_size, min_fails=100
)

# Print the results
fails = result["fails"]
lep, lep_stddev = calculate_lep_and_lep_stddev(fails, num_shots)
print(f"LEP = {lep:.5g} ± {lep_stddev:.5g}")
```

### Performing a QEC experiment (online)

#### Authentication

The `deltakit` library also allows you to access advanced simulation capabilities that
are not yet available in the open-source local code.

To access them, you need to obtain an authentication token on the
[Deltakit website](https://deltakit.riverlane.com/dashboard/token).

You can register your token by executing the following code once. You do not have to call
`set_token` again, except if you need to change your token.

```python
from deltakit.explorer import Client

Client.set_token("<your token>")
```

#### Experimentation
Generate a QEC experiment by calling the cloud API:

```python
from deltakit.explorer.codes import css_code_stability_circuit, RotatedPlanarCode
from deltakit.circuit.gates import PauliBasis
from deltakit.explorer import Client

# Get a client instance. You need to register your token first.
client = Client.get_instance()
# Generate a stability experiment with the rotated planar code.
circuit = css_code_stability_circuit(
    RotatedPlanarCode(3, 3),
    num_rounds=3,
    logical_basis=PauliBasis.X,
    client=client
)
# Display the resulting circuit
print(circuit)
```

Learn more by reading the [Deltakit docs](https://deltakit.readthedocs.io/en/latest/)!

## Support

- Found a bug? Need a feature? File an [issue](https://github.com/riverlane/deltakit/issues).
- Usage questions? Visit our [Q&A forum](https://github.com/riverlane/deltakit/discussions/categories/q-a).
- Have a security concern? See our [security policy](SECURITY.md).

## Development
Help us make Deltakit better! Check out [Contributor guide](CONTRIBUTING.md)

## License
This project is distributed under the [Apache 2.0 License](LICENSE).
