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 theqdk[jupyter]extra).qdk.azure– Azure Quantum service integration (requires theqdk[azure]extra).qdk.qiskit– Qiskit interop:QSharpBackend,NeutralAtomBackend, and related types (requires theqdk[qiskit]extra).qdk.cirq– Cirq interop:NeutralAtomSampler(requires theqdk[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 qdk_config: dict[str, int | float | str | bool] to Context(...).
If qdk_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 qdk_config must match the
type of its corresponding default value.
Example:
import qdk
context = qdk.Context(qdk_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.
Release files for qdk 1.31.2.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| qdk-1.31.2.dev0-cp310-abi3-win_arm64.whl | CPython 3.10 | abi3 | Windows ARM64 | Details |
| qdk-1.31.2.dev0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.35+ x86-64 | Details |
| qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.35+ ARM64 | Details |
| qdk-1.31.2.dev0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| qdk-1.31.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 43.1 MB
Release files / qdk-1.31.2.dev0-cp310-abi3-win_arm64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
50451624a2d19188376af22976b853104bced7da61fb8d881ec5cf534ebc1005
|
|
BLAKE2b-256 checksum How to use checksums |
37b98c803a228459543fe7f31096d55a1ea4b3d9a74ab9637fc7c3ef7606d68a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qdk-1.31.2.dev0-cp310-abi3-win_amd64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 8.1 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
62f8ad36e5515c6a52d91b29e23f97454a7ee0902c86892a93d5085a56baca74
|
|
BLAKE2b-256 checksum How to use checksums |
792fc9e6ae70bb2b4775d2a0dce3ff195a4423d76d31d32601c1526049f99ce6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 7.6 MB |
| Tags | CPython 3.10 Linux glibc 2.35+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e0f9dfed6aa9f5a6eb6fe0010a4ee0420b687b84f1efca6bf56e06f2502a24f1
|
|
BLAKE2b-256 checksum How to use checksums |
50cb5eca75cf7fd435a86c98fef3e355c88e54f067845f1dd31c89f5e624cf7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-manylinux_2_35_aarch64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | CPython 3.10 Linux glibc 2.35+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d7f311c152c2a75dacd1c570ea7cb0b90e2c652f92939132bec7eba18c397071
|
|
BLAKE2b-256 checksum How to use checksums |
ddf9c979e0f05cc802af8f92212f145885b022894587cf04fbad29f090778fc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qdk-1.31.2.dev0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
c0b547ca54faa203074a884e8173fa0c76dc27b7fdaf0fab59dcceb044a326bf
|
|
BLAKE2b-256 checksum How to use checksums |
bbfedad2c3815eb47cef7af3c64e1a7d424d9de79f518e507e45af132ef75488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / qdk-1.31.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | qdk-1.31.2.dev0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.7 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ba665211d12b03ca3b372ff600c8a1971b4d2a63cd1c7f3cef736e9b4820229d
|
|
BLAKE2b-256 checksum How to use checksums |
793c96f12b35516877e8b9aaa54e45c538ae25a57b663af22c578bba819e2dc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|