dwave-gate
dwave-gate provides the functionality for generating quantum circuit description language (QCDL) programs. QCDL is an embedded domain-specific language (DSL) that uses Python as its host language, allowing you to interleave classical Python preprocessing with quantum gate operations. Programs are defined with the @qcdl decorator, which converts an ordinary Python function into a QCDL program generator that accepts qubit arguments and returns a dictionary suitable for submission to compiler or simulator services.
The following example creates a Bell state circuit, producing a dictionary that can be passed to a compiler or simulator:
from dwave.gate.qcdl import qcdl
from dwave.gate.qcdl.operations import cx, h, measure
@qcdl(num_qubits=2)
def main(q0, q1):
h(q0) # Hadamard gate on q0
cx(q0, q1) # CNOT with q0 as control, q1 as target
measure(q0)
measure(q1)
qcdl_program = main()
To run the program on a solver, use the LeapQCDLSimulator to locate a solver that supports QCDL and submit the QCDL program via run:
from dwave.gate.leap import LeapQCDLSimulator
simulator = LeapQCDLSimulator()
future = simulator.run(qcdl_program, shots=3)
result = future.result().result
Access measurements and sample counts by calling result.measurements or result.get_counts() respectively.
Installation
Installation from PyPI:
pip install dwave-gate
Installation from source:
pip install .
Development setup
Install development requirements and the package in editable mode:
pip install --group dev
pip install --editable .
Tests require the test dependency group:
pip install --group test
python -m pytest
License
Released under the Apache License 2.0. See LICENSE file.
Contributing
Ocean’s contributing guide has guidelines for contributing to Ocean packages.
Release Notes
We use reno to manage release notes.
See reno’s user guide for details.
Metadata
Release files for dwave-gate 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dwave_gate-0.6.0.tar.gz | 114.1 kB | Without provenance | Details for dwave_gate-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dwave_gate-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for dwave_gate-0.6.0-py3-none-any.whl |
Total release size: 211.2 kB
Release files / dwave_gate-0.6.0.tar.gz
| Download URL | dwave_gate-0.6.0.tar.gz |
|---|---|
| Size | 114.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37973ae748ab85c9e2cf4514f6570eb53ea3a60c7c59c7a472c43c0d7b78f2ec
|
|
BLAKE2b-256 checksum How to use checksums |
676453391082de36e8a2d575c5331ccc15cad45ea08b919b0d3bb3854069a90b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / dwave_gate-0.6.0-py3-none-any.whl
| Download URL | dwave_gate-0.6.0-py3-none-any.whl |
|---|---|
| Size | 97.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
883b040f4b7e40c95a4ebe9c9857a5edf8e9d1823b0eb4ba552b5c32d9b01cad
|
|
BLAKE2b-256 checksum How to use checksums |
4123e40033802f46e1a6993a63de652d4bb07d39c1060d65f976e862be5d194e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for dwave-gate 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.