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

Uploaded Source

Built Distributions

qcs_sdk_python-0.21.18-cp312-cp312-manylinux_2_28_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.21.18-cp312-cp312-manylinux_2_28_aarch64.whl (6.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.21.18-cp312-cp312-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qcs_sdk_python-0.21.18-cp312-cp312-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

qcs_sdk_python-0.21.18-cp311-cp311-manylinux_2_28_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.21.18-cp311-cp311-manylinux_2_28_aarch64.whl (6.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.21.18-cp311-cp311-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qcs_sdk_python-0.21.18-cp311-cp311-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

qcs_sdk_python-0.21.18-cp310-cp310-manylinux_2_28_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.21.18-cp310-cp310-manylinux_2_28_aarch64.whl (6.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.21.18-cp310-cp310-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qcs_sdk_python-0.21.18-cp310-cp310-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

qcs_sdk_python-0.21.18-cp39-cp39-manylinux_2_28_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.21.18-cp39-cp39-manylinux_2_28_aarch64.whl (6.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.21.18-cp39-cp39-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

qcs_sdk_python-0.21.18-cp39-cp39-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

qcs_sdk_python-0.21.18-cp38-cp38-manylinux_2_28_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.21.18-cp38-cp38-manylinux_2_28_aarch64.whl (6.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.21.18-cp38-cp38-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

qcs_sdk_python-0.21.18-cp38-cp38-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.8macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.21.18.tar.gz
Algorithm Hash digest
SHA256 4bf39438f3eacd4a015e5819817f857193e67f528b0cf7da6de99c5c67717f95
MD5 a8d718cb838da17644c289604d60c524
BLAKE2b-256 8c27300eda3dacccc8fe0997dde908eb5fd797fec8554296639edc5e6dd1a961

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 156ebcd20de25d9e33f73489b674b7f8037a494e1feb4855c6122652c6534716
MD5 1e2d41fe62c9c99d252b9920682b2678
BLAKE2b-256 931fb0ad30096f701756169685426f6eb3eb3a2d79119783c19bc3973d27fd73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e06def07b1087209fc88dd7c3279eb89110154d413e8547597c138cd510eee40
MD5 276093e0a386e921ad25751ea007b588
BLAKE2b-256 029f0f1ba1817edb8dfe83245e3ecc33a0f6e965dc89da02b330a56a1ab4f0c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f60f0be06cf6dd37eb14ebff257c394345380ed34531822a0dde1041f0d81ddf
MD5 689b30e12b0f05667b76be1f8ae5ce25
BLAKE2b-256 ffc3e18ef47e05a0b0ab89276afa8668d1ca95c74a39d15a103a649761e41c37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7d40a573c41e048f1107ddbee57b8dadb114b4760f9f2721a533808a146a79a
MD5 6ec4ba2e07036ca21a4b91afe3ebef8e
BLAKE2b-256 1956081e91d57b6f421769b70fb3650943799e1aa3ea29e9a225a34aeaccae25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f7fb191c23a78eaac1b1fb06fd1c2b49bb0da4ebcdbf711cb013bb33c27e232d
MD5 2421adb7c157b4b3e32504b7fa84929c
BLAKE2b-256 00941ced84c5ee0b9e858ff3dee9565cea210a1c82ea463fbbc473981a9926a2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bc1f86b49c07f4766780b0dc0998a034a51555cae57c69f1e2838e42fa5a7685
MD5 30fd5dfa8197493e42320ee6382717c6
BLAKE2b-256 aa5b8d372f33e7f5bbbfcd86186b8318a63385d317157eb01fda2993845aeec6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df03a4a859ae7a82a73b811ad5c24c53e0dc83eef8994daec727e97301853330
MD5 8a47cc2386057403dfc98ce204b754ae
BLAKE2b-256 f67f1a2803fabda38d5cd0dfff956c0bd0c41bea317cc1deff31071fb15219c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4e6df01c72e3785b27c01e8ca004f8e837e313b3a353cabedaec297f2481a5cc
MD5 528478bf8b20a843bfed7aed1981574a
BLAKE2b-256 852ddb1750d62e1f5af98b7259e204df4024659d14424cf135acfcba61c5efd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d6e6b28fa6d77080d417083f21d365e0c1561565bad4f91f6d3a58bde429c06
MD5 ee0352be292c02ec3c53ef60a7f74d74
BLAKE2b-256 17654aaf33a4e94088157906eedc74abea371f9201bae048ba3497d16e501cf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ae88fb92aba86897592a21101638cc3c73fdea1dec1c30c2180a315d7010c025
MD5 0ffcb68c15e21c960e4fcf67b13e639a
BLAKE2b-256 eda1c6ec7a979946830ae7b3737f49f79e2783604122776d4b866775435ba4f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41563f0c2d22eae3b9b70fd3f02c145f0138779e5964217c37af480e89c94942
MD5 1f5000ebbb175e2a75bc5dc6a2c1904c
BLAKE2b-256 bac1ff21242ca2cc10b6bb26439d73b1cd94c33ac3a0b1c6337866fcfe9dcce8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 caec7f85830b0ff333b2b92d9ca41cd65965fb59a611704cf0f8c3091b2ac1f8
MD5 90ad0c9d0b963f3f7fea1918d342aec4
BLAKE2b-256 9b76758116133269338918f172d978a0bc359e6f7a985b5b6d615d73ddbe491e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4737f608c958db4c2d1f4c8bcd51203b961cc829a65129c0664b01711f0bfeae
MD5 7fb4c9353747db860e6de5894c095163
BLAKE2b-256 9914afa13dcffdf0c754ea1a81aa3902865a2c8408296b0fdc97ea6d6f48954a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 40e3b3aab34da5feac68aa20700fedab9638a0af2e67c58bf5e5209603ffaa65
MD5 bdc8c4354a5dbe535effdf85dfee0ee8
BLAKE2b-256 2e10e22aa34a1e711eb98f8501ef287411be3af67d80a1f3e874f804cd47f934

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.21.18-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 892006c46575fca9a2d3e5be5854fd1f45f72438496a948d38fce2d3b67165fe
MD5 83dedb20e07170afee997636e3435fe3
BLAKE2b-256 6f917b9869d28e6b86702ad5ba8215660638cdc38ed9ff9ae76ddd8363049bdc

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.21.18-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e62a0ba8b6bde20ff4d48112948296dc4e23e08345607c9da1c76dcc6f15a0a4
MD5 09f4e82d4fa8b1d0858f1ee80e8c59ac
BLAKE2b-256 e0c25fd7f21ac01ffcd0bc25f26673fe260c89f0cf13e46ece54c23eccf8751e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 020cbd8d8a592dc272d750346c387744ce3def0f3240ddd21fc57ca416ffba7d
MD5 5c3733612baecd63e71383d48aff86e0
BLAKE2b-256 060090f75fb52a283eecf461c35436fa502e3311b9341141864dff74135b77d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp38-cp38-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 48e40f61c8184f373e8780194038ec7afdbd9556056cefe9646c5aaeac8cb0aa
MD5 2a26d5bab5ec031f0e492dcf9b6ada14
BLAKE2b-256 62af764fd1ee59b2b8e21876e2be35789fc6ff1305e201bda6f47b557bc90bea

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.21.18-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12ec02c59b1e0603ecfd0101900ff09d675b481852fd4be95c8fd39a14305233
MD5 6ac95a83627a57714e97e35507ecfad3
BLAKE2b-256 c49813c5f8c62b5f309efba24280c78a1c3a9760411b285081ac8ead87460729

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.21.18-cp38-cp38-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.21.18-cp38-cp38-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 125f4b539f4b38ffcefcd300be617db4a16dde6aa1445d0bb09d7580570a816e
MD5 fc87497cc505a14a009934ea45b2b0c0
BLAKE2b-256 036154253b1151c00703febb4afc7a51869a9ac0556c228475671a45da475866

See more details on using hashes here.

Supported by

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