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


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 Distribution

qcs_sdk_python-0.26.0.tar.gz (858.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qcs_sdk_python-0.26.0-cp313-cp313-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.13Windows x86-64

qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.0-cp313-cp313-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qcs_sdk_python-0.26.0-cp313-cp313-macosx_10_12_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

qcs_sdk_python-0.26.0-cp312-cp312-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.12Windows x86-64

qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.0-cp312-cp312-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qcs_sdk_python-0.26.0-cp312-cp312-macosx_10_12_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

qcs_sdk_python-0.26.0-cp311-cp311-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.11Windows x86-64

qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.0-cp311-cp311-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qcs_sdk_python-0.26.0-cp311-cp311-macosx_10_12_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

qcs_sdk_python-0.26.0-cp310-cp310-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.10Windows x86-64

qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_aarch64.whl (8.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.0-cp310-cp310-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file qcs_sdk_python-0.26.0.tar.gz.

File metadata

  • Download URL: qcs_sdk_python-0.26.0.tar.gz
  • Upload date:
  • Size: 858.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.9.4

File hashes

Hashes for qcs_sdk_python-0.26.0.tar.gz
Algorithm Hash digest
SHA256 78b6e69399b83879b9e9147a073d0280eb6d1f730f7625aca6721962cb8b7e4a
MD5 a056eca3e67a714fa89524a8b3b69148
BLAKE2b-256 c52e578257303861fe4e91b14b9081c94f4568df4df3d800fde607a172df583d

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1c84fc1af0e402d6ee7643ad384ef95175ea59c51ae6289f6adfe5403b8e50f7
MD5 acbd0f61c590c5f470dab70e28fe1587
BLAKE2b-256 6e40450427c6c4cabb74127b25e8c23c10eb5c4e4f40e929aac367c6ef0ee793

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 95fb39768afb646edd9cb07e9989edec8d1145d73c6967c7bee2c642f5fbe078
MD5 dd554ef1004d9246082c71f09406a039
BLAKE2b-256 8e57b0def5bc1c73827008df8fc9b1e8ec111aa762f9c1cd4fe30d3d28c1d71a

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 404a4b77148afdf27c2b9f26baaca25cb9b896ed90a872ea863105322b4fed82
MD5 008d3517b66f270f2e1c6ec898186a9e
BLAKE2b-256 6f266625fa29f5d99ed8819942ac14b8423348846e66dfea2a060dd3754f1523

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a203789818515a6fc7456fdbbc5f72ab00cee4aa407f2974f7754aa688959df8
MD5 5f0712b866fbc7933faeb2a4e4ee7eff
BLAKE2b-256 89fb06c8067c061b4e8e7a6d8b0073ef3bb35a707422e5ecf75cbda76f62e275

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6219fbdca1aa751fce5adffa85c00d322a39f6bdf5f93696dfb9d6aaa8951f1c
MD5 d05fe005bff50cb266d7ccf958633fee
BLAKE2b-256 1ce38e595c4d197cd47891b3474c61886dc1847204a0276cb760091571e2f3c6

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ccc209694042f94af819da0a4ea894749642c331fe6a95aeffa6337b04f6a87a
MD5 722cea115d1154f65a5be0a9cda74be5
BLAKE2b-256 cf49901ce10e6f4a1968760e2a1b85958e5c0e7bd5d5da3e2d34dc81c9581e39

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 44f91787a1a63ba6a8d938cfa1a5b36f49c085357b7d22a153b3dd7834a2f4a0
MD5 a66a9918a2a51f0b2ee6911c7b899f67
BLAKE2b-256 c0dfaad4a416789170c77c89db10e5cda9682969fef91f48883398851967eb98

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 edfc40cae6c27ccb638e3f35a94a43b1f4366177f34c3b3f7deef13aa0f78d6c
MD5 e26e37eb76af4a737bc95e0bae9d98dd
BLAKE2b-256 60c507fec9f3fbb071db37705078f4ea4f01490070e643d84e62d5cd000f7680

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19f6c1179b28401b75c32948701a8183c2547a968e64410f6aa5ebe60f56facd
MD5 89ca630214d99e8a2cb8301f2fc40a9f
BLAKE2b-256 b8d69ed60f2207f58355a7b25961321885206c687cdd93ca54922b09f0c66e80

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 bcda5de7c7a6ed2886625e84e24788b18fc88178136f5a894ca1d551bbd5f7f9
MD5 6f84a0497a44434d9454a86e58a5f108
BLAKE2b-256 952e4f53d11919646e106e8784f7cfb2b8f2740a8e06554b1d654860a54eaef1

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0a2346e24bd6d25dfd3be4e2ff91d724fa72d3ef3dc3382146f98c68d89af3f4
MD5 25ca1b9386c2f721111c617e8710936c
BLAKE2b-256 0107464c1da7a6a53af7ff8fe21bac9de03a67222c0a023a32405d5e04d573fc

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d98362b9800823cb93324457bdfe58f7d074054847309293e3b089b4f10f18ca
MD5 e0ed6553b92e3db1636755656b4ca4bf
BLAKE2b-256 26728d2c822b52d010ee90185a0cd194d8b0251e89fd3e01a89714a4da444f51

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ace16d568dc40ef4f5e10ddaf3002e1829a1cd580eccab5c252ee729efd9785c
MD5 2d1114e2678b3bbcac59682169c62b0d
BLAKE2b-256 8b3314f93d668f76d9dfbd87e9ee689c6a294a48e69776de38352a332d1ea871

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e67336b60b475a0d43d964571282a4a354968cba20eccaada4cfe48413dc1707
MD5 0c912bcccc5d6741876346df2e544f36
BLAKE2b-256 55ccb0b4a2f834219e901c150767e7c1647ab5cd3e81bdd7a539f3373321829b

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f9693c0f3014e0835adbf43801c4aa141eff338c2f9651129f4db54b3c0aa15c
MD5 b887c860ee161531380e8ee4fea638c5
BLAKE2b-256 baf65b2629acfdf22df1132d1d8b5b7ee0725bdac79df722658e607f8cd15f99

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 50a802b046dd788edd095902a9876fbc029ed8d27eb544b6a3bad2419a031b92
MD5 a75aa3997c274815c089cee32387502d
BLAKE2b-256 0c993e26a69a280958644d4ce3411256997eb153c3d71f56e9199910beab6690

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b0babdf41baa9c2f09ff4f2be8d9cd7a6cd533431ac8eed26dabb131f2e547ed
MD5 10368e7b93e4f7e3766576a15680ae4d
BLAKE2b-256 f3c21e408b51be96be2b145cdab9f5521ab1707eb31329b62b97a42c272df23b

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 052efbf7a5c052f3d87639165d0fbffb187a63eed5d4d44efc02d168dc465240
MD5 800bc6d336e636c32a6145ac7e58f475
BLAKE2b-256 2a97841e2960e793fc3a9c786564502aee8921f26c5c51466a18717ca16d37c9

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e971188109bc885d34b909826a60fff4cae7ca318c28fd049d4dd763ed19bd6d
MD5 4bcccff044c70f731a41c6bb3a53f4b9
BLAKE2b-256 29efab8a1edb4a6e40f02054aeac6db61ea3d89088b91a8965510e9ecee374ef

See more details on using hashes here.

Supported by

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