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

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

qcs_sdk_python-0.19.2-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.2-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.2-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.2-cp311-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.11 Windows x86-64

qcs_sdk_python-0.19.2-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.2-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.2-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.2-cp310-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.10 Windows x86-64

qcs_sdk_python-0.19.2-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.2-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.2-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.2-cp39-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.9 Windows x86-64

qcs_sdk_python-0.19.2-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.2-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.2-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.2-cp38-none-win_amd64.whl (7.2 MB view details)

Uploaded CPython 3.8 Windows x86-64

qcs_sdk_python-0.19.2-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.2-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.2-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.2.tar.gz.

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.19.2.tar.gz
Algorithm Hash digest
SHA256 1afee795886088966ccf47d2f08e92ca9ee67e638d19b5e874beb20a8ed94662
MD5 2488c0043cfae4d67fb608de1cdb7e5c
BLAKE2b-256 cb585f46b0f96ec766f66664bc618d827ba23e99e79946479a62a0cbabd05a57

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 984d756a4b8476b35fdbb3ea81281611ddf79e2ce4b90d18114885439fdfae1f
MD5 f2178f71d929fc0893b2773a0b3c5660
BLAKE2b-256 ff02d35bcb67d923164cb54af5910426a5e9766fee2846b8062680d4269a50dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4a73a97579ae01af6028a3fe2b4cb8bccde586aa8a8105147854a881c799530
MD5 17d63bda7d7285b6999c3cc3b434db21
BLAKE2b-256 4c44db20e4dcdfa2a435cb25aa7e188899dd3d7600fd1d4834a959ce7483674e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ade3dc05dbb40d46188a053e22017a9c3ca19c4966b6683610f5a92edbbf1ee8
MD5 a240c1835a30461905c4f534a47122aa
BLAKE2b-256 1ad05e0a5a4753730758c4b5ddd6a5dc5b051cf8c097b62d9e94e43be805c445

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.2-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.2-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 f6c2566263f763f34c8788d45f6ae5c9e66ce1d499e8893fed5cdb7e92f81037
MD5 53d30f1f26fae898aeaf62bd75c56f98
BLAKE2b-256 935cc94d2c478437a9ebaad507302d459bf633792542645a0aa3e8ae3c61fea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 b0da9bd7aab909887282392ca3949ef4b7f6cac2f0ef5fddb44f0d92a9f04d0a
MD5 e67ebb3865593431aac0b52670d6acd5
BLAKE2b-256 42174f085e461d862a358103394927cbc67cb052bab081fb5ea412b7502a35ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0b91527b5b4afe8097a8ba4a7553d1f4cb66881989c7aecbf3c77e7306529845
MD5 57afb83007761a7d7dfe508230a7de70
BLAKE2b-256 ea702ab91ef3088761496ac3ef7d01f764f776dcfbd188040b91093ff78b01db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 98d3216b5abc803c182b96908d08c81f127c8c25b0641c7c47c890945dbe67b4
MD5 fc0118427b94356effec901aa2837bc1
BLAKE2b-256 1dce8a20ec9825e1ec620e6af820cd2ecfc01e2f17c76f92537b836b7b9eab8b

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.2-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.2-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 391112537398d972ba1f99e842245bd5f1b48e4ed3fd4d2bf433553544e23ddd
MD5 a7298e60f53703f2ba1280c469ba84d8
BLAKE2b-256 fdf27a4dba02b1042d43eefd70bdce14d67260e56877517ee8ff1651d65e4023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 b49dafce624c50e22b01d6d8475458932629551296ad0a50880023f956148b20
MD5 5f049e84e4aaff3f75e3ab86ba85ae30
BLAKE2b-256 942251caabe167bdae15cff5f37b662374ce58b46c916b32feec14ad38fd28c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c16aa92a9e629c3e564f42d72905f47c74fdeec7beaa1f3e0b0b5b4580737eb9
MD5 2bfc747b178e49d4d7eebd9c1ec9bb4d
BLAKE2b-256 74e27e76d24f3250e674259fb4204209d58f0f5a69b08648bdf50a7e26bd80a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 59649a5b7749dfa4d73bad557d0583f426b523874d3e59a507f5ca95b1b22471
MD5 ba7741f965410d5ce2096d4a316ea8af
BLAKE2b-256 e6e464cd024c6278c65fa7c556eb2c1c953017bde5923e8057cd78e8057e7a56

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.2-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.2-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 9ee89af75d0d0a250683ff229c9c9f8358e499719087284a1febe3bcc0e4ba1b
MD5 962427bdcd66b9da39bb63750d94eb8f
BLAKE2b-256 f88a38e44afd692446daadd743458f96c70d1977d60f339f02bba9030e931dd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 ac685957a7c3bfc999aaa5eab8236bc1c71bb58beaf4b8190adc3823f872aba7
MD5 d1ca5c34192ce9cd4840fdd233705349
BLAKE2b-256 71ef22bb0b6cf3c771edfbd421bb6829225ff1051fd4f8f2a250ac094c56e88c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c557b1beb86cf3c187fbcedef4e13fb7e4d9d745f9f60a6f742f4cdbf40efdc4
MD5 9ea8c48723d7b531b6d4142e48deea21
BLAKE2b-256 0f2b8fc3f348229bdb18784b1f400907266e2153d1434b9404d27de106347350

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7fb40e7d2a74ac0d5d09ce556a70a7e00460f3959404a8c84f16aef2afb62b12
MD5 60fcbdb1f692c959dc1a97c2cc87e525
BLAKE2b-256 7954c978ca5dd27418f49f1d98d752c2529e59454f49c12393bb063fbbac1b2c

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.2-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.2-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b6e84c5c91f7a4e42b9be725b94479f5ed5358ffbb9a9780e041b3474e825138
MD5 ce371865ab854b8cf6f7845d55355403
BLAKE2b-256 8cfd4166df8eebc0ca5988c7d31712efcba2afde3b9f87403e38aec76b93e72d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 5fbbb300db12bc1d6848779056c32a2626c380e87f0d108cae46c8cb22e9f9f8
MD5 539832bed6c1cd3a73d64baca2d49f80
BLAKE2b-256 6b8cd099cc2b631726329fc336de3bf52d9b0a1020e7112fcee14eb25eaa628d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 544117335e69f609c05eb2e0d49c513ad1483bcb4bae29988720ed9e0d7cafa3
MD5 897591265290cf0dece28755e2f35e93
BLAKE2b-256 4b1419a2bf0eaa98014b6e263f093b065d91685ce7e8dc615f74877ac06c737e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.19.2-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8d6694b5c2d9f07d8017cde0952ccd4ba5156e3ccfd2caa1b06890c40f74f5e8
MD5 4f2c929bd310b48f57b45d8077216c89
BLAKE2b-256 a439580b9b36b178eba104388a4dbf5dabefcf0b8e91af43b6d9c9641ca214b6

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.19.2-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.2-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 837069d3556ccacb48489ba25387e120acd085cacb0d02cd83bf7eaccf2f015f
MD5 1110c96ec47c7c33e973e8b6794e3b3b
BLAKE2b-256 522e3974258932c2f04768ab8c164c71fd2218d5de3a00be806c324d1f31c4a8

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