Skip to main content

QCS SDK Python

⚠️ In Development

qcs-sdk-python provides an interface to Rigetti Quantum Cloud Services (QCS), allowing users to compile and run Quil programs on Rigetti quantum processors. Internally, it is powered by the QCS Rust SDK.

While this package can be used directly, pyQuil offers more functionality and a higher-level interface for building and executing Quil programs. This package is still in early development and breaking changes should be expected between minor versions.

Documentation

Documentation for the current release of qcs_sdk is published here. Every version of qcs_sdk ships with type stubs that can provide type hints and documentation to Python tooling and editors.

Troubleshooting

Enabling Debug logging

This package integrates with Python's logging facility through a Rust crate called pyo3_log. The quickest way to get started is to just enable debug logging:

import logging
logging.basicConfig(level=logging.DEBUG)

Because this is implemented with Rust, there are some important differences in regards to log levels and filtering.

The TRACE log level

Rust has a TRACE log level that doesn't exist in Python. It is less severe than DEBUG and is set to a value of 5. While the DEBUG level is recommended for troubleshooting, you can choose to target TRACE level logs and below like so:

import logging
logging.basicConfig(level=5)

Runtime Configuration and Caching

pyo3_log caches loggers and their level filters to improve performance. This means that logger re-configuration done at runtime may cause unexpected logging behavior in certain situations. If this is a concern, this section of the pyo3_log documentation goes into more detail.

These caches can be reset using the following:

qcs_sdk.reset_logging()

This will allow the logging handlers to pick up the most recently-applied configuration from the Python side.

Filtering Logs

Because the logs are emitted from a Rust library, the logger names will correspond to the fully qualified path of the Rust module in the library where the log occurred. These fully qualified paths all have their own logger, and have to be configured individually.

For example, say you wanted to disable the following log:

DEBUG:hyper.proto.h1.io:flushed 124 bytes

You could get the logger for hyper.proto.h1.io and disable it like so:

logging.getLogger("hyper.proto.h1.io").disabled = True

This can become cumbersome, since there are a handful of libraries all logging from a handful of modules that you may not be concerned with. A less cumbersome, but more heavy handed approach is to apply a filter to all logging handlers at runtime. For example, if you only cared about logs from a qcs library, you could setup a log filter like so:

class QCSLogFilter(logging.Filter):
    def filter(self, record) -> bool:
        return "qcs" in record.name

for handler in logging.root.handlers:
    handler.addFilter(QCSLogFilter())

This applies to all logs, so you may want to tune the filter method to include other logs you care about. See the caching section above for important information about the application of these filters.

OpenTelemetry Integration

This package supports collection of OpenTelemetry trace data. Clients may configure any OpenTelemetry collector that supports the OTLP Specification. Rigetti will not have access to the OpenTelemetry data you collect.

To enable the integration, you should install the qcs-sdk[tracing-opentelemetry] extra; this installs opentelemetry-api. By default, no tracing data is collected at runtime. Because the QCS-SDK is built as a pyo3 Rust extension-module, you will need to use pyo3-tracing-subscriber to configure collection of your client network requests. See qcs_sdk._tracing_subscriber module level documentation for more detail.

import my_module
from qcs_sdk._tracing_subscriber import (
    GlobalTracingConfig,
    SimpleConfig,
    Tracing,
    subscriber,
)
from qcs_sdk._tracing_subscriber.layers import otel_otlp


def main():
    tracing_configuration = GlobalTracingConfig(
        export_process=SimpleConfig(
            subscriber=subscriber.Config(
                # By default this supports the standard OTLP environment variables.
                # See https://opentelemetry.io/docs/specs/otel/protocol/exporter/
                layer=otel_otlp.Config()
            )
        )
    )
    with Tracing(config=config):
        result = my_module.example_function()
        my_module.other_example_function(result)

if __name__ == '__main__':
    main()

Release files for qcs-sdk-python 0.27.0

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

Built distributions (wheels)

Table of built distributions (wheels) for qcs-sdk-python 0.27.0
File
qcs_sdk_python-0.27.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
qcs_sdk_python-0.27.0-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
qcs_sdk_python-0.27.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64 Details
qcs_sdk_python-0.27.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
qcs_sdk_python-0.27.0-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 64.1 MB

Release files / qcs_sdk_python-0.27.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL qcs_sdk_python-0.27.0-cp311-cp311-macosx_11_0_arm64.whl
Size 8.7 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c0c966516ecae5e748d9210d22331e507d456d44eb6e80475e9d5ad17cd79649
BLAKE2b-256 checksum
How to use checksums
77297c1ee911bd1e325b0d382f74254d53b3b170fc862bdaa3105c8ee40c215b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp311-cp311-macosx_10_12_x86_64.whl

Download URL qcs_sdk_python-0.27.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 9.1 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
788426a6b8508b6521241278bbc7fa4b89704bd5143e8afaed8e676b97b1d4f5
BLAKE2b-256 checksum
How to use checksums
bcda9dd28427f798218e081411b8a69537968b04a664309651afde876143033e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp310-cp310-win_amd64.whl

Download URL qcs_sdk_python-0.27.0-cp310-cp310-win_amd64.whl
Size 9.9 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
78f360509ca69eaad97d6a444cb4278b8f73bb5968aad6f1aef6cb21316a7a74
BLAKE2b-256 checksum
How to use checksums
8cfa54641721ac8c8b29e163e50204735413fe84e7809ca01b10882323cd7242
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_x86_64.whl
Size 9.5 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
397a4dd9681074a1cd2f3bb49cc49ce73203adaf05b1741d5c327ed41a8e4f06
BLAKE2b-256 checksum
How to use checksums
6df2d0c4053830c66bc6847a598becccc61c279b8c37b21b90639e2263c272f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_aarch64.whl

Download URL qcs_sdk_python-0.27.0-cp310-cp310-manylinux_2_28_aarch64.whl
Size 9.0 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
3f7007a75478036d8ff443b667afd9335762f7b99df289c05a4cb81f66ce0732
BLAKE2b-256 checksum
How to use checksums
a1d75e2aff53552307816836b3e6786173295f215633d34372e353d2713b99fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL qcs_sdk_python-0.27.0-cp310-cp310-macosx_11_0_arm64.whl
Size 8.7 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
02c4fdac1e9362bbe635e11ca782e6ac68c078d0aa6ba2d4e5180f69db1f1bb3
BLAKE2b-256 checksum
How to use checksums
e190732801275ae623f4d7d77d596816e5be485519aec97411e0f79ae1dadf53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release files / qcs_sdk_python-0.27.0-cp310-cp310-macosx_10_12_x86_64.whl

Download URL qcs_sdk_python-0.27.0-cp310-cp310-macosx_10_12_x86_64.whl
Size 9.1 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
25cc942d6ec2f66bf01ace4ac59ef99d4671045e280759ce744b6df5cb11f384
BLAKE2b-256 checksum
How to use checksums
943f6aef505dc232e541cf6a43dd5dbddf121a9ffae939b083ee55efcf0da407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.9.4

Release history Release notifications | RSS feed

This release

0.27.0 This release

7 release files

0.21.7

6 release files

0.21.4

8 release files

0.9.1

12 release files

0.9.0

12 release files

0.7.0

12 release files

0.6.0

12 release files

0.6.0rc4

0.6.0rc3

0.6.0rc2

0.6.0rc0

0.3.0

1 release file

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