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.1.tar.gz (859.0 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.1-cp313-cp313-win_amd64.whl (9.3 MB view details)

Uploaded CPython 3.13Windows x86-64

qcs_sdk_python-0.26.1-cp313-cp313-manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qcs_sdk_python-0.26.1-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.1-cp312-cp312-win_amd64.whl (9.3 MB view details)

Uploaded CPython 3.12Windows x86-64

qcs_sdk_python-0.26.1-cp312-cp312-manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qcs_sdk_python-0.26.1-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.1-cp311-cp311-win_amd64.whl (9.3 MB view details)

Uploaded CPython 3.11Windows x86-64

qcs_sdk_python-0.26.1-cp311-cp311-manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qcs_sdk_python-0.26.1-cp310-cp310-win_amd64.whl (9.3 MB view details)

Uploaded CPython 3.10Windows x86-64

qcs_sdk_python-0.26.1-cp310-cp310-manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.1-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.1-cp310-cp310-macosx_11_0_arm64.whl (7.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qcs_sdk_python-0.26.1-cp310-cp310-macosx_10_12_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.26.1.tar.gz
Algorithm Hash digest
SHA256 ed85045e05d88007304244f454ba8c0f27ae4b36ae88a3b71cd5c7afdb5dd7ab
MD5 a09f8419024d2e2d0d27087a21ada874
BLAKE2b-256 3e182a93058e8a5af45745bf48c62d2688f88d8446975c8909332a0debffe5b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 aa8c91b1945b73959b181fd80a267dd81410c46d6d4eb980365dd8ef2bc2254e
MD5 ed682db2f9c031af2fb0c85fefdf0eaf
BLAKE2b-256 6216513564b7df4fac1f445ea48d5e436e5810620b7e01be25a544229ab7f060

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dfb031e1bc16e25aa786207fe7cb1999c492e88208e4cdf0b7d3d9bada402cef
MD5 7ae8f0a5f8b73d16d89053c8b795acc8
BLAKE2b-256 73753f01fe0fec7e98afaff6708b05da3d4fda9c25bc20c021d180100a8b82c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 edc2bcae6f122a9016aa13422217eee0b11d080da8fed50c3788bc38aa9bdeb8
MD5 ab5649e5dfc59b2938e4583d08181faf
BLAKE2b-256 8964e51eaabe2d5c6715aa97aa33d8671cdbf0a61dbc897f4a3db3c7a9c7ca2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8cdc8d3815cb84fa2906349dd749e7120ce8d351cfd956c6bdbb3e68018b8acb
MD5 f976fc2f46117b323d7bc915b3a0b710
BLAKE2b-256 87450cecd13f8a4f852b3b4fbea418f89306921db68dceae19e1bc116f46fcb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 014d0f7d94027eb8cb46c1c349a70b7bc5119d1ae0ed66562a9ee7d689f23491
MD5 5b3072f72afb75503c59dcaaf67b4e16
BLAKE2b-256 98e06a1d4dd745e264b14c9215837303461c7b8c95ef8073b17518e344929975

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 aeddb0c0f1c13ecf714a9c14ee9928e4092a29a21411556ba8acd5a2a9eecdaa
MD5 20d7d756fa41efd55017edc35d1048eb
BLAKE2b-256 e1a4230ab9909e2db552bcffec906084a2be9315215318dcd6c1a8ba27f319d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c92e9acce0599c51b6555660b2d65eda71f78457ab6fcacc0d4690ee0030306
MD5 6bfabb72ce7d993dcdd3cd4382e8e9ea
BLAKE2b-256 da6c11335d679d672aad76e1cdeb4121689f44c1ad54ecf0b291614b8fec8dc9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3d7240f48061c1fdd37ae1d4da306454d109df97d6fb3162ff600c9db7a16eae
MD5 bebf563618906e72aa0b1c5688daa3a0
BLAKE2b-256 5529e33067f0a045066adfc66350702f17b4d7a049ea0e53121113c428a5611a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e831c725881f890f1e376984e90f193cc5546baca3f13bf00fb910a19305083c
MD5 8053f47aac6e36ea7fd281ceab91b592
BLAKE2b-256 73708d3b2b088453ce22ff3b740b765faf7627fcf0aa8e3ab865f949e0a91901

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 78ecc0a40baa7e8e460ee02cb11b60f432d1b85ae0ae17ea8f2db7a91408c406
MD5 85a5203f07a683206602e38c4440c702
BLAKE2b-256 4f12cc3109f5ccfe69025d98b4dab1bb653ed2528f3c821f182cc5f2b40ddde6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 041ef717a9161494208b0917841571a3e1da8859127bfe50fec092c914c0bc73
MD5 4bfb50b500d0ed113a3bae9ab9330727
BLAKE2b-256 d2510e019ce5b731846979f06b9fd467d2ed5b70e829628b249abb4538192472

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab0f9e084edfec8c115ee570dc4245d356d198442d8fdd2c8dca48600005ca89
MD5 5a45f9c4471d5fad7eef8a2d97e48986
BLAKE2b-256 7f70d997889dd8062e24c3ee4438df4a5e532329cccace3a01f971ad89671e7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 779331eb6601b063e12ab6208fdcaf52f16888cf37a23b6198ce2d77eaf2eb35
MD5 2636dc444dff8141d232dd93a8150d04
BLAKE2b-256 e24a996cf052e47826973c3d8c9164cdb5920245657dcf872eac2de10d1454cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 feedc2b8b8d8e6016a16ab76f44f070bfec7bfe4671c1ab1adda45735f98d57b
MD5 121520933b1c422066f46373e0176a34
BLAKE2b-256 f987aa7177fc1da3829bc42d39b7f6f67b4ffc7744339e764fdaa00375980fb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 49c3ed68c9d9184762db3acc77ebdc392095becd27930d21e1420fa086b615de
MD5 0c0b2ac5e09cdf6c6965d580010a7981
BLAKE2b-256 1db8ceefdda071ef930451dddf5ff3b70e27a7dcc92206e6b4b6acaf13698b4b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 acd24535dd676920c65d4696885eef786604058627b2c89736666de97820aaa4
MD5 ba6eb5fe94a2a42511420cf2b5269271
BLAKE2b-256 8509ee92298666dd05328cb6cb7a8c0b44a4e9f68d8289f31a6927071a3ae09b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c23cfccfcf03e7261fab81bee7de5de2184841d24b6876de41a909b0b7874b47
MD5 f1e17d5331823ee17fc851636ed91880
BLAKE2b-256 54f7103c28b7c4706c021381e5685bd179ff21fe2d02f9c353ca5c8664d18e7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d956bb583b41230700e2a7cc88fec7639c46cf1a67297c722323afbae57eb653
MD5 5c53ed1708fb4e3a4288bf767c6883c8
BLAKE2b-256 872d3f49ba5dbe54e5aadcf26ea313b41d6706505ea03da79552d185666576cb

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.26.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ca8a284e7250d3caa852a05274984eea41a05e9002ccb1efa2da5f28fe2185a4
MD5 e5c714515d909483b31ae3cfb56ce340
BLAKE2b-256 df92298f8f6d3096622e4d2a2945e2e7daa84f39a4e3307892e649f537fec525

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