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.3.tar.gz (859.3 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.3-cp313-cp313-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.13Windows x86-64

qcs_sdk_python-0.26.3-cp313-cp313-manylinux_2_28_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.3-cp313-cp313-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.3-cp313-cp313-macosx_11_0_arm64.whl (8.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qcs_sdk_python-0.26.3-cp313-cp313-macosx_10_12_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

qcs_sdk_python-0.26.3-cp312-cp312-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.12Windows x86-64

qcs_sdk_python-0.26.3-cp312-cp312-manylinux_2_28_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.3-cp312-cp312-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.3-cp312-cp312-macosx_11_0_arm64.whl (8.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qcs_sdk_python-0.26.3-cp312-cp312-macosx_10_12_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

qcs_sdk_python-0.26.3-cp311-cp311-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.11Windows x86-64

qcs_sdk_python-0.26.3-cp311-cp311-manylinux_2_28_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.3-cp311-cp311-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.3-cp311-cp311-macosx_11_0_arm64.whl (8.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qcs_sdk_python-0.26.3-cp311-cp311-macosx_10_12_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

qcs_sdk_python-0.26.3-cp310-cp310-win_amd64.whl (10.1 MB view details)

Uploaded CPython 3.10Windows x86-64

qcs_sdk_python-0.26.3-cp310-cp310-manylinux_2_28_x86_64.whl (9.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

qcs_sdk_python-0.26.3-cp310-cp310-manylinux_2_28_aarch64.whl (9.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

qcs_sdk_python-0.26.3-cp310-cp310-macosx_11_0_arm64.whl (8.8 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qcs_sdk_python-0.26.3-cp310-cp310-macosx_10_12_x86_64.whl (9.3 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.26.3.tar.gz
Algorithm Hash digest
SHA256 763b3f7252e49d2e29e7f274c81076b0c0c0dfe96ee79ed0a2cae1d41608d03c
MD5 75fbf73c7f807e14c439fc3eb5b0d6f2
BLAKE2b-256 5bd71525f2085e3e71438f63e0d62ae9d3edc0fbcd45160df07691e722750841

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 717494ab46013c78ed3d9a8d2895152ce2246933955696ab7c706dac0ffe05ce
MD5 52ec60876b3858ff4c81c527e2dd442c
BLAKE2b-256 9f4e210e035192185b16bbc5f497d91bb5b01009604c36eaf89fd68025eaa03e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e10746f9651e463a6efacf0f185da6989b344c4d864df448f6dd746aa223fa5
MD5 bdae9a36e443ed8bbd1879fd8747c990
BLAKE2b-256 ad33ff45849e6a46f8d145e446988dc597b766fbcb13ea7f75b166662ec612fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c349f157f27c2b3df331431c88599f3841ad26f82e7980031109ef58cb2a2bd6
MD5 88d42be2eb47f44d49001df59eaabb62
BLAKE2b-256 cebb65da0231f000f85957fc5cb3de00248a2ddfff2413a54b148803c1627d14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b3ad000b0cdad6da338a947bd196c8403f265cd4d610077426375f4239f64e0b
MD5 4eb2c8fb5f606a8574ecedf416d06c7f
BLAKE2b-256 689775732f6d33dc9e77d21fbd297a34a15cea180ceb97ac32b4e81e291e2fdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dff1b9314013f2b171c1cb9e9d676528cb2bf0eb65b33c1321a3687b7d8dd1b0
MD5 82044f0c6d3bea44ea5eff6baec79738
BLAKE2b-256 033d7be82e95d275faf14f4a9b5aea0a66befbcb0930db46c12508130e416e76

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 213edbc31b851327f1b84d39b4e9290c2f68b7829d3950e1da312f151a9e48b2
MD5 ffcdfe2ba97cb638d4a128f956840969
BLAKE2b-256 e6fd5b0565fdac3aa9ecde08a3852e845314300210566f22219f9a5b2c98deba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 66cc712e7df4f2ad74566d2978099699390b5aa7aaf079c4dc30c843c6d053be
MD5 923f2c173924052bbcc651e55fc292c7
BLAKE2b-256 1fb025d344cc5600f0f054c9e619dda6d64160a99eae70b8f7ff8c7f5a24d1df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 36ad3772d1b7a4c966c0008dcd78a4a548e53fe7e5aa1fae895949d58501cc33
MD5 98744bb3e6f485b9d71d904a87914161
BLAKE2b-256 11cf95dda974ff8e1ee1c1c5457e89936d72b0f4717b4b689f33f3800e1fa0c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 817ecf6283401cf93029ee540e50c0b17f2221ac0a2d7e1325f97a0adb719834
MD5 ce868e83135adc3cf39320c6f0438368
BLAKE2b-256 d1f882e4d4dc03a38d0f09459197f6d440802a508c761eef442a70fda8de30ba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6153022a07f4a6f71fecf326b83fb4943897bdf378b1e4317dc788b995e48268
MD5 469e14df56bf635f6bd0f07f702df5a7
BLAKE2b-256 414fba5169c5704d60d6c8e73725807258e0a67f18d1466ff959c32f7112f61e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 b3c0a1542a43623d9c80e37c2bf6d634058152373332fbcc44252e1aaa9b779f
MD5 5b30f9c64bb6312e68e9e4d865272b25
BLAKE2b-256 2e0b492e8d6448e63e8c7bdd31c926f5f17ec0831676df1363cd3f9d8d052c2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2e2fa01ea56ed2f3c86c170269d1d7c4ed1667d22b9a878560223928023d51a0
MD5 7e9394fa4e4b4ab8defeed79872a4c01
BLAKE2b-256 630fb7ef92e752b0681450e496bcc4cd33c81bd0c1a4ee94b0389978a3451a95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6af43038ec093b5341dcc5995566d15cee2fa75a0247612c019bdcb15a173e3b
MD5 c75cda9ca8724a8a09d371de20ef5152
BLAKE2b-256 1a41f179597d61967919c0e1fb3423c4a86dbe9adc2b7242c8a62cfe8ee73893

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 36fd537a77523b89ae005d2f655a0600518407d6db6c0e8915d02fdf5ffb263a
MD5 c6fd475a875e6745fed2b3e82d92b982
BLAKE2b-256 be17bdd497be9ba3165aa845e02be8d52a6347bd78aed10871d096ab7c373a19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9b5977977e3f439c9a63a038de934b417e32e461e09170823c58167b1f66b1f3
MD5 628793e789839987c4610fd29e01abdd
BLAKE2b-256 9f35f8c58a544543283b6999124f96a1ba76fc8dcb14a1d7ae7c8daee4f2ac8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c95ed8aa8d4eb8a921d9ffdd866588a23bd503340d2c646b1753da6b5dc3af84
MD5 7e497dca777d7a85d4d3f31b580e9226
BLAKE2b-256 5a55dfb69382bf4680713777e6a64616617a9e023095ed5d4e61fa5b497af2f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 821721b414e04ccd194e96d31bf85399485d6723c92666a7aca71e40cdec7767
MD5 5289e7329b06e1c89d333ef7aee16264
BLAKE2b-256 2741b897d595897db273924f38931decb90b3ad5fe1a9fef355d37930ebc70c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 260fa9edff85af881d04ca6c3ceff4eb0de1b540fb2521238a338eb733abb477
MD5 486860a2e932ac16052fd9974fc6abd2
BLAKE2b-256 ca238d7d0351a1c3624db02532d030ddcb711b2e8019046e74e0e627caeaa059

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c25851ae1a5177b8a936230172ba175d1a64bd415e264c1823774bc8e68f592
MD5 7f368ce0cb5af73d48f866dba3c15f21
BLAKE2b-256 695ffd4a119e0f279cb82009a8910a22a00068b0269084dbb42f25eb15f9e1e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.3-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 788f272a3c02eae466d474a494bcc81675aea6d7266d1fd64841f97291b8b500
MD5 a9dea48a72bc7a881e3fdda70f89fc7d
BLAKE2b-256 fcde6602442dbca346cb999c93f8679678bb8381fe412eb4fc66daca1680d37c

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