Skip to main content

Python interface for the QCS Rust SDK

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qcs_sdk_python_grpc_web-0.20.1.tar.gz (245.1 kB view details)

Uploaded Source

Built Distributions

qcs_sdk_python_grpc_web-0.20.1-cp312-none-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.12 Windows x86-64

qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_ppc64le.whl (6.7 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ppc64le

qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.3 MB view details)

Uploaded CPython 3.12 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

qcs_sdk_python_grpc_web-0.20.1-cp311-none-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.11 Windows x86-64

qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_ppc64le.whl (6.7 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ ppc64le

qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.3 MB view details)

Uploaded CPython 3.11 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

qcs_sdk_python_grpc_web-0.20.1-cp310-none-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.10 Windows x86-64

qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_ppc64le.whl (6.7 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ ppc64le

qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.3 MB view details)

Uploaded CPython 3.10 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

qcs_sdk_python_grpc_web-0.20.1-cp39-none-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.9 Windows x86-64

qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_ppc64le.whl (6.7 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ ppc64le

qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.3 MB view details)

Uploaded CPython 3.9 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

qcs_sdk_python_grpc_web-0.20.1-cp38-none-win_amd64.whl (7.1 MB view details)

Uploaded CPython 3.8 Windows x86-64

qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_ppc64le.whl (6.7 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ ppc64le

qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.3 MB view details)

Uploaded CPython 3.8 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1.tar.gz.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1.tar.gz
Algorithm Hash digest
SHA256 1f745691f76839fdb5b4f07fd8b79c19bb19c3e50d49f4de42143b68fe999bc1
MD5 5374f9d71b36a50778d3f98a5fad0a8c
BLAKE2b-256 7f5656b45812f4041fbe17a9ae468722bfc67b827961b457a9509abc303a4946

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 81f7bd316fd7ad5392eb2fc98e0219787c011f882df9a04b7ff95b099dea7406
MD5 d0633c9bc36c790984f35504531613a5
BLAKE2b-256 3311694892e5a4df384f496a58c1c65470dcaddf93b3d4b241f3495c24e3179f

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 11f6e4e1651a0e5f0fd0cfe22d292e5f17cd9fafad0fd6b35aac550bf1d7a7ef
MD5 a3dfc0a30c128133a9bd9e7bf7f29753
BLAKE2b-256 5283004b0146cd7daaf6963703f357b2a22f40e7d6ed462914b59fb2214e5929

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 4145aa9ac380046182851c20341200f306588b9f33d68a9f023a51422845665b
MD5 9ded2460922066a48bf8cb9972db78c0
BLAKE2b-256 b8e9a6c56a209ad2a8bc8c0a00351e83ec3eae42c6e5e1fa191bf965e055e3e8

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 64e53e85e2b122ca8fb2227fac83227f046431289211618f60375733c8d2269c
MD5 dfe51b3c050fd6e6f0725e5a751cfd35
BLAKE2b-256 05fd096d06703b5f9f187938d1c06dc1bc0827dc0118c3e490e48fbdfbbc3b6a

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 0db516840bc6ff78043f2a10ab214f31a29b48c8dd4a8a3aa2bbbbde40eae2e2
MD5 7ceb8853da24ff91ba51bc4062a94732
BLAKE2b-256 96cea0936df5642ef3912d71d099a8e24cf7e34c8d05e596d444e535dddebc58

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 05ee17f759f5a88bfca03fc35442735fb1cb19b11e277851ae6c7f11a9c48f07
MD5 a33ec38adcfa220201a529139dab96e4
BLAKE2b-256 0aafd3bebf0e1ab2f9402decf44f6bdf77beb392d89714fa2ac8c0dbecb92edc

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 d1a874c9f5771d0640a3371bec4e04b428fc8740b2135f75e08f1b754b7938f8
MD5 f7be1277f2d1892b98a68e9023b2de7a
BLAKE2b-256 dce4339f9eba569008c7fcc219bf976cf177e63744ed325eefa6c8c3b23c938f

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 73e4878524401a97e1ce0786a521205eee28c061976bb7c1d590d4e1aa8a9513
MD5 65cc55ca3a2c6a7915657fb5b94f9323
BLAKE2b-256 ccfda36f1d76c4ef527cddfb6b888fdfc2553c09641769b441723a7941d316fe

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 d7c7e97811d4a1a44e8e801e91ef806d3ff25469a71cbef88791f065aac56811
MD5 991b76d2b8e0bffa9555f604c6f2996a
BLAKE2b-256 6e27cb403e142017e679d1a71bd82862784b72d9d97d513b50bdfb7445937a91

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 58cd5b21d23e0f62c3492dce8b8ce5648ac78c6ede09f53e6878010ef20a23ba
MD5 f8c79c65a14b7ff7d267fbaf80410bd1
BLAKE2b-256 36f955d04b9df17b33b391357f4478b5aec335680da75a6150829ffa1f194c30

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 d428faea65b410f00b796a5a03c854b9b1362922e5bf7ae4dcc6b1e20867e761
MD5 c050711da5639c822c93581ad5b539da
BLAKE2b-256 da9f0bc71a6bd4f5214f15d08004a1b9fdaab928103db7872be7ae5a96b78b06

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 1d42508ef4e4d301be12afd953bfbb19d2e391d62bc72d606a90b0c92bd46377
MD5 77305c1b2b13a3fff7fe0675939d5abd
BLAKE2b-256 df877abd6aae992534aeaedb110193ffe8d5ae8ac18f564904da6f45b5f1207c

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 57205ce6db0f94f1974960ea24b6b7cba28ea9ea9fa11261d2714a68be85b272
MD5 1e5208e0920ce85ce563e17cc5f2a5db
BLAKE2b-256 fc07380e9f87c40ae9be7da7e7e8b8a2c4e56b00936784ef56f4e4eabeeb5797

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4625f39fac041621fd249c0aaf5b2c6fcba6950cf8a63d4886315e9d81ebe612
MD5 a90aa742be7f02a79b1b6782ffbe9222
BLAKE2b-256 b299681bb8c924b0ae73a0e1b9fee4dd5d4cfda8535f6776f3c14947e9b11c36

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 387a7bd84aef0b29331b5eb3a5fed45746125356f6180e6366b6ecbe2cf78ff0
MD5 f0c3f1c02b0be2d17658e39772a86873
BLAKE2b-256 37cfce17738353743781a54b78eadf31cda8edd0e13bb909fe36f65c36e36ce1

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 ad7255a352bde9509eee89d2cb3652a669d0f6ae3bf33affdac5e1bcf8faf4c9
MD5 93c33ccbcbd62d3ed8bcdfe80cfc4bc3
BLAKE2b-256 224950ae5204d259233eec9340255f6b2cd6de45b9c2f81fcbf01914312067f1

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 cf7f102ae346a9437ff87b3978554f5269632d9385242ab9f5295d2260521d1a
MD5 4fdad39e623ac106d204865776458a8f
BLAKE2b-256 de73b2f32689b4d6a8cf45787d8db1baf17b9cf16b0bca47aa73a4825e186e0a

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd5802df7933c67ebaa19c312e208eaaff75ef1cedf6f1858d5c01c89562496c
MD5 c7ed4fbe10c416f70bca7af53f324999
BLAKE2b-256 80f4703bd3762e2ec46cd2c934b2fbc99778c02f34b4b2ab5a693984a655600b

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_ppc64le.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-manylinux_2_28_ppc64le.whl
Algorithm Hash digest
SHA256 503c393318c29635b6777e5a6f8e4fe69cebeb293bd603d97c9072f54367f74d
MD5 8bf21fcd436723808963283bfab9adbb
BLAKE2b-256 888d175027b5d6cfd441751b8fb82a165d860facbbc21c84ef7d0395cb948af3

See more details on using hashes here.

File details

Details for the file qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python_grpc_web-0.20.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 21a8159304e5de8a559c2ffe37f5d37455508d97b7a7c767e97a08a1b18f1587
MD5 4d65bbca01809a8b14b985929d5953bc
BLAKE2b-256 8d841de19f6932daedee01ba1993260a30e920aff62e12757439f5bbff7084f2

See more details on using hashes here.

Supported by

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