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.

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.

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

qcs_sdk_python-0.9.0rc3-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (12.8 MB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

qcs_sdk_python-0.9.0rc3-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (12.8 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

qcs_sdk_python-0.9.0rc3-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (12.8 MB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.7 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

qcs_sdk_python-0.9.0rc3-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (12.8 MB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c9ed28ff30ce28bcfe7fd91181d88986420712688de928a43c1405e74d8d01f7
MD5 4cc2bf757973b81c87f070161a989230
BLAKE2b-256 873939ba6f46f1b12344553f6eb18a3edc18754a10c66e507bf484904e022fc0

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ed725312db21891dff8a938a656859667ceaf5204f49c4bcee0a1d6c050c07fe
MD5 6dbdfff8f0c8f18b2f3cebdb399adeaa
BLAKE2b-256 7483cecbe4493425aba9001d08a780bbb131ccf5e08a4822aafd4443039b9123

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 8da74598801d9000e7264dc4ec2976540cc66b09690814c860467c68c9948a36
MD5 61f864220e471757c6b2587e3dd16ebd
BLAKE2b-256 91f098087df854428e416389137c4a3c55a95d321d2fe4f434ed2d527211b87e

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e61dba4f2e8a0c29ae647c83832e0a9b1d473e3239b62517f20e63c3663aacee
MD5 02df4a5907fff1e024c08fe4fadd323b
BLAKE2b-256 ee2d2c8b8805c39e925046a3518e8a82c71a85383a1d91582ac9a35bfde5ad69

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 92f531a725cb0f574c40847d45652b10a67e3245bdf50a94381c0b526fbdad3e
MD5 9424a862bbd6557639c897d7248cc4d0
BLAKE2b-256 25c3394def5861c0b29bcb578928fe3dc4c776b5f5ca2429f0b0cd8356b237b5

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 bebedd63adcff6dd1e2a40f32b035c33ec267060ee632924a6f1fe81631247ab
MD5 47e2098fa8f5130ab3ac46cfa227944d
BLAKE2b-256 d85fcd56e14085f6c765bf59b965dfaa953df04c7a404372bb9fce131be868a5

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4206ca8409ff7021dbe0b05a2b16216f2b5d31865f3cab4a0a487bfce39e6b92
MD5 3d3c058d1fdef2bf1a6eb0fe73a022dc
BLAKE2b-256 7b83acf0637fa2534a3c7f144c8530be8d09b4443e786adda5fe01b8761d1254

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 02df3176de1cbd7e3e479964978d61faf6c3907cddf495390ab0e9f347dad946
MD5 e5fb1f7d32abb0e647fc3a107b5ade73
BLAKE2b-256 0107b10830a6151c8d5d130d45fac66698ba0f00c615bd3388a59ee54669860e

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 990bd896fc8d6a242e3a0c821c31c092af33cd7092b829dfc5c36c22a1676d93
MD5 85b24aa05a00d927e7668e8dd6800715
BLAKE2b-256 5b75ad105e9218164b68768ab0884a1e29b3e53f6b4f2ee494236c2ca285cf69

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aa6641cbba8104a5aa10c206380958406078e83534f340a05395ddf0fa432726
MD5 ec8ebac59946e7f4f9dce3fe7a119e3c
BLAKE2b-256 dead949da2397a5ce3848c2b567738cfb7ce9a785dc57f141c1a16b1859db80e

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 028a367e0c3085aa890bbf066dc5c2aae162d731892ee09d49f888ebdf3fe7c1
MD5 cc5cb9076c4cef15c3fb2bf3bff65fb1
BLAKE2b-256 814280ace895c45cb6871522bef1905249313085d9c42d15f40b16b8b9d95caf

See more details on using hashes here.

File details

Details for the file qcs_sdk_python-0.9.0rc3-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for qcs_sdk_python-0.9.0rc3-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 eb5c66c9e025eec48c1a3a6c523499248c1fca2de4ac5f17b346e74e238fd43c
MD5 286841667b7badfb830b644ac107a9d6
BLAKE2b-256 f8a93b9d0e8b4c48a9a4fcdfea49e444e69bdb48b74c0906fef8536337f84429

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