Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

qdk

The Quantum Development Kit (QDK) provides a single, cohesive Python entry point for compiling, simulating, and estimating resources for quantum programs (Q# and OpenQASM), with optional extras for visualization, cloud workflows, and interoperability with Qiskit and Cirq.

Install

To install the core functionality, which include Q# & OpenQASM simulation, compilation, and resource estimation support:

pip install qdk

To include the Jupyter extra, which adds visualizations using Jupyter Widgets in the qdk.widgets submodule and syntax highlighting for Jupyter notebooks in the browser:

pip install "qdk[jupyter]"

To add the Azure Quantum extra, which includes functionality for working with the Azure Quantum service in the qdk.azure submodule:

pip install "qdk[azure]"

For Qiskit integration, which exposes Qiskit interop utilities in the qdk.qiskit submodule:

pip install "qdk[qiskit]"

For Cirq integration, which exposes Cirq interop utilities in the qdk.cirq submodule:

pip install "qdk[cirq]"

To easily install all the above extras:

pip install "qdk[all]"

Quick Start

from qdk import qsharp

result = qsharp.run("{ use q = Qubit(); H(q); return MResetZ(q); }", shots=100)
print(result)

To use widgets (installed via qdk[jupyter] extra):

from qdk.qsharp import eval, run
from qdk.widgets import Histogram

eval("""
operation BellPair() : Result[] {
    use qs = Qubit[2];
    H(qs[0]);CX(qs[0], qs[1]);
    MResetEachZ(qs)
}
""")
results = run("BellPair()", shots=1000, noise=(0.005, 0.0, 0.0))
Histogram(results)

Public API Surface

Submodules:

  • qdk.qsharp – Q# interpreter functions: init, eval, run, compile, circuit, estimate, dump_machine, dump_circuit, dump_operation, and related types.
  • qdk.openqasm – OpenQASM compilation and execution.
  • qdk.estimator – resource estimation utilities.
  • qdk.simulation – noise-aware simulation utilities: NeutralAtomDevice, NoiseConfig, run_qir, DensityMatrixSimulator, StateVectorSimulator, and related types.
  • qdk.code – dynamic namespace populated at runtime with user-defined Q# and OpenQASM callables.
  • qdk.qre – quantum resource estimation v3: estimate, Application, Architecture, ISA, ISATransform, and related types.
  • qdk.applications – domain-specific quantum applications (e.g. qdk.applications.magnets).
  • qdk.widgets – Jupyter widgets for visualization (requires the qdk[jupyter] extra).
  • qdk.azure – Azure Quantum service integration (requires the qdk[azure] extra).
  • qdk.qiskit – Qiskit interop: QSharpBackend, NeutralAtomBackend, and related types (requires the qdk[qiskit] extra).
  • qdk.cirq – Cirq interop: NeutralAtomSampler (requires the qdk[cirq] extra).

Top level exports

For convenience, the following helpers and types are also importable directly from the qdk root (e.g. from qdk import code, Result). Algorithm execution APIs (like run / estimate) remain under qdk.qsharp or qdk.openqasm.

Symbol Type Origin Description
code module qdk.code Exposes operations defined in Q# or OpenQASM
init function qdk.qsharp.init Initialize/configure the QDK interpreter (target profile, options).
set_quantum_seed function qdk.qsharp.set_quantum_seed Deterministic seed for quantum randomness (simulators).
set_classical_seed function qdk.qsharp.set_classical_seed Deterministic seed for classical host RNG.
dump_machine function qdk.qsharp.dump_machine Emit a structured dump of full quantum state (simulator dependent).
Result class qdk.qsharp.Result Measurement result token.
TargetProfile class qdk.qsharp.TargetProfile Target capability / profile descriptor.
StateDump class qdk.qsharp.StateDump Structured state dump object.
ShotResult class qdk.qsharp.ShotResult Multi-shot execution results container.
PauliNoise class qdk.qsharp.PauliNoise Pauli channel noise model spec.
DepolarizingNoise class qdk.qsharp.DepolarizingNoise Depolarizing noise model spec.
BitFlipNoise class qdk.qsharp.BitFlipNoise Bit-flip noise model spec.
PhaseFlipNoise class qdk.qsharp.PhaseFlipNoise Phase-flip noise model spec.
Context class qdk.Context Isolated Q# and OpenQASM interpreter context for independent sessions.

Configuration Map

You can provide configuration at initialization time as a Python dictionary.

In Python, pass qsharp_config: dict[str, int | float | str | bool] to Context(...). If qsharp_config is omitted, the configuration map is empty. The map is immutable after initialization. To use different configuration values, create a new Context.

In Q#, read values with Std.Core.ConfigValue(name, defaultValue). In Q# code, config values are immutable: in the same program, repeated calls with the same (name, defaultValue) produce the same result.

Supported types: int, float, str, and bool (corresponding to Int, Double, String and Bool in Q#). The type of each value in qsharp_config must match the type of its corresponding default value.

Example:

import qdk
context = qdk.Context(qsharp_config={"experiment_name": "baseline", "shots": 1000})
assert context.eval('Std.Core.ConfigValue("experiment_name", "")') == "baseline"
assert context.eval('Std.Core.ConfigValue("shots", 100)') == 1000
assert context.eval('Std.Core.ConfigValue("noise_level", 0.01)') == 0.01

Telemetry

This library sends telemetry. Minimal anonymous data is collected to help measure feature usage and performance. All telemetry events can be seen in the source file telemetry_events.py.

To disable sending telemetry from this package, set the environment variable QDK_PYTHON_TELEMETRY=none

Support

For more information about the Microsoft Quantum Development Kit, visit https://aka.ms/qdk.

Contributing

Q# welcomes your contributions! Visit the Q# GitHub repository at [https://github.com/microsoft/qdk] to find out more about the project.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qdk-1.30.2.dev0-cp310-abi3-win_arm64.whl (7.3 MB view details)

Uploaded CPython 3.10+Windows ARM64

qdk-1.30.2.dev0-cp310-abi3-win_amd64.whl (7.8 MB view details)

Uploaded CPython 3.10+Windows x86-64

qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl (7.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ x86-64

qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ ARM64

qdk-1.30.2.dev0-cp310-abi3-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

qdk-1.30.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-win_arm64.whl.

File metadata

  • Download URL: qdk-1.30.2.dev0-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: CPython 3.10+, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 025f0b1e8b53aa77669bbb373482a8a95b3a77361de15ea059a34302de5782cb
MD5 85b5a048afb580ee1f8819830f9ddc5c
BLAKE2b-256 252beb0da91eeed3999330a8aef302bf12665a53e1d48f0670f7733481903b62

See more details on using hashes here.

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: qdk-1.30.2.dev0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 7.8 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e861ed6c741fa199e58ca3622ca475dca7c53ebfe556b66207f0c30ca721e32d
MD5 5bd417e0a0e311fa6c09d93b6c99b897
BLAKE2b-256 d87d50f19dab67527bdd87ecaf05ae9c05e139064558558a8a2c8781be82953d

See more details on using hashes here.

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 51e309167b1b49c4edc7f93740c761f0d7c420dca91846c56ca93f1a9d801d3c
MD5 79655c65dfc22c0e6e3f98b808b8a334
BLAKE2b-256 d21b26ffe865c524594ab169be908af4a9be9dc515892f253808239dec80952c

See more details on using hashes here.

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl.

File metadata

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 3ef79568c382feba7aae44de9d44da64e17f9b8e71dc91e20feff3b556bca3ca
MD5 5cefed4cb53b4f1d05fcf4d287c0e8fe
BLAKE2b-256 95d3b75f6d9250077fa8ba4a61e9dd57d0136db81e3571bf8ba34c59dc3cd5e6

See more details on using hashes here.

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f90050e9676e4dc84c795537ee7202da34d10bcd949b927772ec4b9a7a08ea8a
MD5 3018961925e89921e68f79fd5ac59b7e
BLAKE2b-256 86acacbd309b8ea1613e1d50b3f38832c948c92122d6a6faa987e26ee995efb6

See more details on using hashes here.

File details

Details for the file qdk-1.30.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qdk-1.30.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9344222526182664588a9d5378d3d35ca45f5c92c946debc9f504c69bb3dbf9b
MD5 b9dca8fde66aa897757da215158e9ee9
BLAKE2b-256 49746393d8b683ab78b1e50bc8009e6ec626f2e56b66a12aa91822cba9a6cb02

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page