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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

qcs_sdk_python-0.26.2-cp311-cp311-macosx_10_12_x86_64.whl (8.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

File metadata

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

File hashes

Hashes for qcs_sdk_python-0.26.2.tar.gz
Algorithm Hash digest
SHA256 ddb37055166c98a1e3518ddfaee38d542e8d0e7fc9b25c14ded0e68383ae4ea9
MD5 6b3a20e9c9942b7c5df91c98ef8409fb
BLAKE2b-256 0fcfe5798b47bb9043c9916b2577a477abe2fa466ed58b7f45a4475b22b98e8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9d3325ec3b870dde2b242794d112e0f23763d35151dad59a44ed5372d6f833e6
MD5 75752c10bf71403cd8666962139349e7
BLAKE2b-256 067344ab01866935f95159e9d1ab16d8b81ad238467b7d2b7b838e8686aa131a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 44c7db42fbcc189c4b2667b79e5ec08e016a1c20565336d08caf9eb93ac38bc0
MD5 881a47cffc0a5797052b65e734a7fccc
BLAKE2b-256 aaa48301f212e8a372b04aa9e0bbfc233775e73358a204fe18bf240234acd96a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 32e2e93ea31d5b81d7503721cf1f849fac22dbf66ecc3e03842fd7ef9d473f49
MD5 81efb587352902421cad7e050f4faa82
BLAKE2b-256 cabbf06cfb40795c963bf67fa0d14d0e505c54bbf85ae303701ebc31a17aee4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 810d1bd024fcd1d6883858b10f65b6278ae7fd0beef0b0b566bb0cee79bc12db
MD5 3a04007b9d84eff38723418075ed3140
BLAKE2b-256 4700d541b5615dd1d99639b45dfd1b132ccb83b1e94b5958a5462cadaefec51e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4b089df4291bcbdbf9be316a23c1b376f1aab4c2b9999fc056691ce6ee083083
MD5 845af4f45e4972cdebb138725ab58ab8
BLAKE2b-256 dede3ee3ad09930d36cd1faa272161f545ed39ec03998b11a82c92c9f5942298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c6cb97ab5c37d05fc59013f4067ea2915b1591e233fbdae0de7a1dcbce735d43
MD5 e3fcc21f8db85e04d9e1574912bbf976
BLAKE2b-256 560ff713a75cdf1650f1687c630776f92c58f98d4c81ad3d7b28688a4e839739

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d8dd528a2ef36058bbaf12df4897a2a1cfeaea4f9cc096b2b537f86da0240d0f
MD5 e7d8440af16389361e8c3a3f6e092a6e
BLAKE2b-256 63913fb9fcc05dfa455c462afb26d3cc80dbbf5593b18b5d6adb20a7c83bfeaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e3392ca5ad6516a0330a8b06eee121da252c1ef68980d87b625b48419f810241
MD5 60954edd11a1ffd2220307112931f578
BLAKE2b-256 4e76aedcfd239c3bbc6205a6c3a61ac83b2e166ec7638b632f237261ac029783

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00847a71016cd8910097f16517a9fed6e665b887dc616c95859b5106243ca358
MD5 ebce700ca773439dacdf75739953faae
BLAKE2b-256 71647fa4fb3c8ab28983d88db00daba9811c2784ac318ac8acbb6ddba748707b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a326cf48f6d76fd85cbb3a0270b2e71df5d393ee2dd2b073061356ce78a17d1a
MD5 c76e8f31fdc3fc89c992c89560a738e9
BLAKE2b-256 ed6c3b351d722f8e0f5f5d237005af9b04d32762eca67a04e46d9e80b75e6558

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7380f8f1d9270491cf5c0376dd45b628aa7ecbc24d540e8623d70d8a65a10664
MD5 6d935f6ccf6be50674f0107e1942fbc8
BLAKE2b-256 b49123e1583f826a6006175f840bb4aad15263916fb212ccb722c57c219dda67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4e5599fd982e6f451a95f7717c7a944a456262571ce9ad8bc5dbbda04cdbb707
MD5 d3c8933f0e0bd893e76cc86c0f2e9771
BLAKE2b-256 379242bdafec6f129f91834449e341aacff69554dcd96ccea940d2e13408e433

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 607013bc8391156674a7abb83c2d40cf2ffd36071af05ed76165790b46c6be7f
MD5 15cbe00b9c451a911d0a84241162af52
BLAKE2b-256 a6987443ce42312593579454edc61ee00102d722591d3ea6de0a4c46de58e310

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc8bee6a8ba2e2e104ff6260fc053e799bc1f4c71e77a2b019e4b59cb7893107
MD5 8d71f5d9c607cd0688175d05e5f5b761
BLAKE2b-256 0bec98d5f6d82d8c21ab6e4533861ff74e7fc173f6d2df65840624bf9233af44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a7a7c3d2903d5ec6871716d68724668494cb3825e229c882c001b5f69047d028
MD5 7f0e31a30e52e5fb5b8433ae79404cd6
BLAKE2b-256 8662e4a5e4256267d112dfe9b314ec34dd59b4ef9bf679f3860af1c22c64717d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d957194d823925d6772d8ae672f736fce7d1669a8961153fd91079ee7be8638a
MD5 5a2c6921f183bcec3f88b50d2fdc5f7f
BLAKE2b-256 dd2e4b5107836de0e84a526c93da9cbc71124823eba1c8c11ab40f92dd5b1439

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0a0ee4e43e8f851915b25cc15162b32e9d6afd920abc1f13d4340a7ac1b485f2
MD5 dfb4717324638a36f4462deaf3b9cfd5
BLAKE2b-256 fa3e8150119d492269e7c9d0658e244c6a16e538816455a2c1c5d0390d1bfd5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 43d871f7d190f3d418a7004714d32cb3f1dc80aa4f9de669ff2e96df78507d42
MD5 edddad5615089a7cbc29decaed79c0cb
BLAKE2b-256 1ae585c9f861ccf695b2de2b6110d7ae88be13b9ced806957983b36b1a60d617

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e1195ce514e0ef46ae5cf6c350169a052c96db1c86870f8089bf1e43a5fe6b26
MD5 0f727b020dd28cb633ca1caeae899064
BLAKE2b-256 7f5247c521d71cbc274fab7fb59390c9d85633384f7d66fb6d74423c3aabb9f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for qcs_sdk_python-0.26.2-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 14d10c2ee44777dfb412d1099b9f74f07f841cefa8e8b9e0d54c1f30da5184f3
MD5 a9d29ea29eb2de6720f2a6eaf8fe0371
BLAKE2b-256 308b27151f4ffa051151185a975df307892627f5fced59295d3e93eef2a39631

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