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.19.3.tar.gz (243.7 kB view details)

Uploaded Source

Built Distributions

qcs_sdk_python-0.19.3-cp312-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.12 Windows x86-64

qcs_sdk_python-0.19.3-cp312-cp312-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.19.3-cp312-cp312-manylinux_2_28_aarch64.whl (6.5 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.19.3-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.7 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-0.19.3-cp311-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

qcs_sdk_python-0.19.3-cp311-cp311-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.19.3-cp311-cp311-manylinux_2_28_aarch64.whl (6.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.19.3-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.7 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-0.19.3-cp310-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

qcs_sdk_python-0.19.3-cp310-cp310-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.19.3-cp310-cp310-manylinux_2_28_aarch64.whl (6.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.19.3-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.7 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-0.19.3-cp39-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_aarch64.whl (6.4 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.19.3-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.7 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-0.19.3-cp38-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_aarch64.whl (6.4 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.19.3-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (12.7 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-0.19.3.tar.gz.

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.19.3.tar.gz
Algorithm Hash digest
SHA256 78b6fd804ff24f2a2d2948ea06bda0ba9761beb55eae780a154f84a826632d48
MD5 d07e1fccbbcf20e49045355458317ccb
BLAKE2b-256 b15864f5d399fb410c467ad8db9c265d172e4c8a4c4749c1e85cc445a3e0a4c3

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 c2e68128454832f9a05a3eb4402b78cd64cafe8b5e5bfb0e4d7f1c64208c21d2
MD5 8f6910aeaed289da0e07274fa3a71d75
BLAKE2b-256 46f9eb764afdcd6b8d426c824048673ae2272c845e27ea2d3a203c00f35d7e91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 288456f5244977f8a4694687adb66ee3c09bd9b65a1fd52a707a4adc24c77f78
MD5 9e70c0ae1b90dbbb8bd14f280f1570fd
BLAKE2b-256 1524885906e0216f0c6a8fc2c46bab31f8b55c29fab1d86eed7d76b76438baf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a9eacf61b0d5b3f405ac5686bc24a0b08070e37e55599e251094c7af4f8a7576
MD5 4d33b597d2de780221073be60e9fb9d7
BLAKE2b-256 373887acf2470c6321cb4443c75cd60568b7989c2219b592b3fcdd780668f603

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-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-0.19.3-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0c75eda136f020c6582eecfa7da5588a46aa7662e1dad687d424a57c74a74a7a
MD5 1f7306f0d5be317e7b1faceca2db6414
BLAKE2b-256 f69545afb89923744f7cc84af090166af33838214c6d832c6801bd234e7f79f2

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 d360da8d7e408be6910dff27a45db36bb66b477413e1126cc702c225d9b41d3d
MD5 5cd3aec9fdfcc2e8c9b718044883855b
BLAKE2b-256 e09434222c826a0e5bce409ba63d546dcf2f198f14362152b136ab043bb87c7a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4922a9a9bb90a8027b6ebe3089174b80b04cea20732449ee1543d098bf4b4db7
MD5 22489f4d84dc920407e3251c56db5a59
BLAKE2b-256 990c6c4211491becdd2fd56f16b02c50059075b9d06152f64b93ce15055dee5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 321433d6a9828913325ac7ebdd15b5acf695f8c6840b74a696007d57fa13bbcd
MD5 67b0679a5ab32a4656311384a79d4f9a
BLAKE2b-256 f7248c1f91f20d45b3f1938d137a0705104a25cf8511ca9931c6a7b889d39997

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-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-0.19.3-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0f6859c4cfa6f33a556b97980ba56ce99ed58e259c5d2b489efba6d1e3ebefab
MD5 73af2d5fc6df66ba8a8963ea16beacea
BLAKE2b-256 c602ea9e5673bc5947edec9d8d225893b5b385a6c4e26d32affdd00767b175f9

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 16719c4c50996cc25da3ce42d0eaaa359c40765f9a290ac2d9001a67180f29ea
MD5 bfd82e98e0d501d3c0d08a12a1ac7c85
BLAKE2b-256 7c9193d216c7659063c8b25ff6572636a9e679db00384464c7999e5606f3ceed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2835c15da740fb287f9395306fb4f97ffab6fe2edeb58119ee0fbf33ed2a0b07
MD5 8284cb1b3e7e454a2681ac2dceab3555
BLAKE2b-256 8eac80e3ee5102b197083fcbd5098afda88c15fd79e22998adaf1fa12ac4ee69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5c0216bddffe21bf906b13a5f8ff846942050f1d108bf8f36ebee3d082d0a8a5
MD5 962e93ed95907fe205bacf01463cba8d
BLAKE2b-256 a5dd915e5d338e148ef46462ae69756ebc4b6c39b67f4fe80041b6b5394a347a

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-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-0.19.3-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 692b652b52147412bd62952b611e8fa0a9408f687bebb6c6af60c5e50cb4d919
MD5 8617582386e80eaed1b1124f7441c36b
BLAKE2b-256 ae013ddde1dba92210f39f2e87ebf55264f9258fd5cbb8c11e36967f6119a0a6

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 bf2d3e50b0fcbe8edc10dc826077222f36d3d4427d07b12aa2e65c6e4b57324f
MD5 1f16de02101f4f1feb8c9f699b7f525d
BLAKE2b-256 c6fdb51cbda109c4b1418bb4067a1b14ecb4bf7d9857d5951fb98b542fda68f7

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 163365a124e2bfbf8d2d8eda7289787f665f085e51c3984fe696c00525f1179d
MD5 0429d1d2d0aac77dc016abc8ac1c0146
BLAKE2b-256 331a9fe2e9e0c7c278decbcac3670cf0be121d1187539ba5ddf7f977ddce40bd

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b832482957ca5316ade679fc9cb6df3a663c3e34cdfe231ece8ed4ce247ac878
MD5 d1a2e82eaf0f8cd73c6a1d1e25451c0b
BLAKE2b-256 65ebbd20295b9b144ef0e683d367e070136b52281ee8f84b8bfa86d70b6e544c

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-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-0.19.3-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 28f8e0ef0dfd7edaea988834e9023ff7e389b1f9df6da3a201fa5012feb25448
MD5 ff0fbeefb89b0f200170105cfe44e43e
BLAKE2b-256 e17c7068d6e6f7efe63d1168ff34df76fd09908dd5491c1de68bcd6d1244deb9

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp38-none-win_amd64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 d81f5e2722ddccb562e785060bd4ca80ad4877abdaeb195831a31ed97b18420b
MD5 25dc0ac1720f8a1375880d7c7308e275
BLAKE2b-256 7b912ea95dd50cb6f1b49d173568ca73125874940f8ed3439a3006e7ecb28b11

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 52518da0314535a622fa53ba22003aec1a54461d0f7235ffcd69a7a0efdcc850
MD5 23d1dfd08cdaa103c0fa0cc6d368fc62
BLAKE2b-256 a3a3af500135ec8c793856dd6785f7af5bbc703a0e2ff157c29b83938bc66a9d

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.3-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ae3d98863568b10317fd8dc7f0c9808145bc2abf66f5e50df4532b5bab658e7a
MD5 5f51a4b2de649e37eda8fae7d93c435c
BLAKE2b-256 5b9c81e7c242b675fb9898536f6cb8df5873795dc10b7aa50eba4f8166cd9c5b

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.3-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-0.19.3-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b73ae1b92bd3a7f1be29fc4d8a22b380b05288d621abaf67808d32835e56c235
MD5 4abbd26a109e3e8fbf9e784b70115c79
BLAKE2b-256 3f9a5e48866f7814b2123d163ea7e11cb43be1d6aa94496390a2b1bed5fa5736

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