Skip to main content

Quantum Development Kit Python Package

Project description

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.

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.

Project details


Release history Release notifications | RSS feed

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.29.4.dev0-cp310-abi3-win_arm64.whl (7.1 MB view details)

Uploaded CPython 3.10+Windows ARM64

qdk-1.29.4.dev0-cp310-abi3-win_amd64.whl (7.6 MB view details)

Uploaded CPython 3.10+Windows x86-64

qdk-1.29.4.dev0-cp310-abi3-manylinux_2_35_x86_64.whl (6.9 MB view details)

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

qdk-1.29.4.dev0-cp310-abi3-manylinux_2_35_aarch64.whl (6.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.35+ ARM64

qdk-1.29.4.dev0-cp310-abi3-macosx_11_0_arm64.whl (5.7 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

qdk-1.29.4.dev0-cp310-abi3-macosx_10_12_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: qdk-1.29.4.dev0-cp310-abi3-win_arm64.whl
  • Upload date:
  • Size: 7.1 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.29.4.dev0-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 8f7ffac3f5d5ad022efc6ed8969d80ff25a78de72d8330be18d48f022b92277e
MD5 a12190b01837545d48d4f6c725d93fa9
BLAKE2b-256 a18bda2649a5c5b0585ea85e82f81b680501f8b8882155ce99fbabf5924cc9b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qdk-1.29.4.dev0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 7.6 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.29.4.dev0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1ad60f18135d24171cf624cb632ce0b792e73184ee4426d084d23b7832d1b672
MD5 9cfe06e9d6d4d953ae3e4aa88fbdfbf4
BLAKE2b-256 5f4d085ec4bc3b4bfb822e794f4b67ec5c185672247e398f53659e990612ab33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qdk-1.29.4.dev0-cp310-abi3-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 1a7bad0e142d4f29c7fcd40acebe7b95b1736237001d2331b70a81a9baaab5d0
MD5 6cfc255bd8002ac4311f00e4dfee6385
BLAKE2b-256 69b565dff82667a0a4801afcfa43c21cd6717d6c0039f22e1eae2accaa3d8080

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qdk-1.29.4.dev0-cp310-abi3-manylinux_2_35_aarch64.whl
Algorithm Hash digest
SHA256 037650e13e6b612fc0eef3591f8ba4f43c59073cb5df8f4f953af29d180cbe66
MD5 48de473325fe52a17afb5a247c7a13f9
BLAKE2b-256 8f39c921b0dfb2952bc2e4a7966263dd762c448ff57d5b53cd45f5a63687a63b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qdk-1.29.4.dev0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9624d4519967c4f4ceb96c1fc04e268bfbcdaab444e299382818c137899d0f
MD5 8b428fc4101b08b53a7edae88fd0cea6
BLAKE2b-256 bd215e64529372870843a892b9c09eb7be9ee39b80a5c0c9032c47d9fa089de5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qdk-1.29.4.dev0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 15691c43ac1c5cfbe9b15c6d05b3c93a70f3bc264d4bd585614b0b33ca1bac0f
MD5 fa76d10a8045268ebf3721f9f3618957
BLAKE2b-256 ea7f7f7088c2874a4634c296c95c482e6e606fc610ac46caf9f301f9cc396b07

See more details on using hashes here.

Supported by

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