Skip to main content
https://img.shields.io/pypi/v/dwave-gate.svg https://codecov.io/gh/dwavesystems/dwave-gate/branch/main/graph/badge.svg https://circleci.com/gh/dwavesystems/dwave-gate.svg?style=svg

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.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dwave-gate 0.7.0
File Size Uploaded Provenance Actions
dwave_gate-0.7.0.tar.gz 121.7 kB Without provenance Details for dwave_gate-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dwave-gate 0.7.0
File Interpreter ABI Platform Actions
dwave_gate-0.7.0-py3-none-any.whl Python 3 none any Details for dwave_gate-0.7.0-py3-none-any.whl

Total release size: 222.8 kB

Release files / dwave_gate-0.7.0.tar.gz

Download URL dwave_gate-0.7.0.tar.gz
Size 121.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c519776b7950f2d46529769965de98ffe318b596b6cf3a11d865939a8a6d382d
BLAKE2b-256 checksum
How to use checksums
50761954dcb5b8f918fc31eefb5d184047fee79d985ad26712214f5e6f61244b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / dwave_gate-0.7.0-py3-none-any.whl

Download URL dwave_gate-0.7.0-py3-none-any.whl
Size 101.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89ed14908365af917d2e03b1d6b13542a40a642e814a4b1e458af7ae1b536b91
BLAKE2b-256 checksum
How to use checksums
43f5b9c72460a29531c22d6e17b98fcbf091dbcc8e437d518409b1cc002608ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for dwave-gate 0.7.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page