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.azure.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– exports the same APIs as theqsharpPython packageqdk.openqasm– exports the same APIs as theopenqasmsubmodule of theqsharpPython package.qdk.estimator– exports the same APIs as theestimatorsubmodule of theqsharpPython package.qdk.widgets– exports the Jupyter widgets available from theqsharp-widgetsPython package (requires theqdk[jupyter]extra to be installed).qdk.azure– exports the Python APIs available from theazure-quantumPython package (requires theqdk[azure]extra to be installed).qdk.qiskit– exports the same APIs as theinterop.qiskitsubmodule of theqsharpPython package (requires theqdk[qiskit]extra to be installed).
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 | qsharp.code |
Exposes operations defined in Q# or OpenQASM |
init |
function | qsharp.init |
Initialize/configure the QDK interpreter (target profile, options). |
set_quantum_seed |
function | qsharp.set_quantum_seed |
Deterministic seed for quantum randomness (simulators). |
set_classical_seed |
function | qsharp.set_classical_seed |
Deterministic seed for classical host RNG. |
dump_machine |
function | qsharp.dump_machine |
Emit a structured dump of full quantum state (simulator dependent). |
Result |
class | qsharp.Result |
Measurement result token. |
TargetProfile |
class | qsharp.TargetProfile |
Target capability / profile descriptor. |
StateDump |
class | qsharp.StateDump |
Structured state dump object. |
ShotResult |
class | qsharp.ShotResult |
Multi-shot execution results container. |
PauliNoise |
class | qsharp.PauliNoise |
Pauli channel noise model spec. |
DepolarizingNoise |
class | qsharp.DepolarizingNoise |
Depolarizing noise model spec. |
BitFlipNoise |
class | qsharp.BitFlipNoise |
Bit-flip noise model spec. |
PhaseFlipNoise |
class | qsharp.PhaseFlipNoise |
Phase-flip noise model spec. |
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qdk-1.25.1-py3-none-any.whl.
File metadata
- Download URL: qdk-1.25.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e7d660cb69173cb964f73164dbaaeed3e7ebba9fbbffdfed607e35ec155e3e9
|
|
| MD5 |
1647c2d3218ec02683bb5a7430cb19a5
|
|
| BLAKE2b-256 |
fc1f65221cccb366b8b15a4a24aeae530f189d9b514463070877280bfdd1b941
|