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
Built Distributions
File details
Details for the file qcs_sdk_python-0.20.1.tar.gz
.
File metadata
- Download URL: qcs_sdk_python-0.20.1.tar.gz
- Upload date:
- Size: 246.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4061b4e30c6e0a957b5c080c64c713a9729f8493515b01f9948707f22c244f3 |
|
MD5 | 095cdc47701b1c73c1d5c7358392f9f8 |
|
BLAKE2b-256 | 7d1521774677bf7b0ead638662687b7cc06a6a605870c277ca240f3894e6ec13 |
File details
Details for the file qcs_sdk_python-0.20.1-cp312-none-win_amd64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp312-none-win_amd64.whl
- Upload date:
- Size: 7.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e4ab6d1ceca4225ad774f16dd28ebaceba5026fec5421df52a6ee39e41f0816 |
|
MD5 | f3f527166600182750f31a72e5b2dd3b |
|
BLAKE2b-256 | c077f577c6e2bec67c9b0364207a1441a5fa46a302da09ec46f804cea0a82d4d |
File details
Details for the file qcs_sdk_python-0.20.1-cp312-cp312-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e34653519f99e6bed7bdd534018151a0d6e140746fb2841eef0d65318dbf5d |
|
MD5 | 8f5b8501207a92ab733a404a3530cece |
|
BLAKE2b-256 | f45091647ca09ab886cd4edb2689adf5995b9d080599e6bce8ac1d57782de444 |
File details
Details for the file qcs_sdk_python-0.20.1-cp312-cp312-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp312-cp312-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdaf737ebc5a0839a2d4db6cda5a9cb3e18a70b2a3a30e134d7ea7cb91f830a0 |
|
MD5 | 08fac5ade8b73870231b6302ac5fed95 |
|
BLAKE2b-256 | 728232eb3ab0fd49fb5dca305d56e310bf41d539e15433a1bebb7c52c4c38983 |
File details
Details for the file qcs_sdk_python-0.20.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 13.1 MB
- Tags: CPython 3.12, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73ffe8c448cf4f3cd2934f8754de670771b30fa96aa92a0cdae5445c925aa23d |
|
MD5 | 8bfa53f11f59ecf74597abcfbb1fd7fe |
|
BLAKE2b-256 | 457211ec5ba0d3d58b38dd8a63a31d59435099f572d36ff271863ff6abac36b8 |
File details
Details for the file qcs_sdk_python-0.20.1-cp311-none-win_amd64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp311-none-win_amd64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a2fec6b493790d4f795c9a2c90dc89b844d2427b3b49fdeecc6533d3d670c8 |
|
MD5 | 1beeab5ed13e9a5ce9ad78cf37bf5ee3 |
|
BLAKE2b-256 | e03979e9c614bc12231d0dd01a6130f52f57a8b4f734364181c9fba7c707ec8d |
File details
Details for the file qcs_sdk_python-0.20.1-cp311-cp311-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d1c0cd0f391ceb531cd1bca836d4c8691062e690e0b9c6a20237b2bea41ac8a |
|
MD5 | 25244162f7b7ad7f42261dbedf4c2511 |
|
BLAKE2b-256 | 8ade940b988e12f0ba760ebff59d57a98e0f04bb428618bdcbd91d2973a894de |
File details
Details for the file qcs_sdk_python-0.20.1-cp311-cp311-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp311-cp311-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccbfea1ed1f75a3887b3988f1afdef3481fc0e4aa00bfd7d59339349cf16e0fa |
|
MD5 | 17f16bf2a41591bac0850ef093df2c2d |
|
BLAKE2b-256 | e152fc35aeffd57aec2a1d8deb1382293328291d2e3174de1736f56f215a65f9 |
File details
Details for the file qcs_sdk_python-0.20.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.11, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4fa3829c1b408b6f929cb32155dec722f7977220271d597e16730a90df9cd9e |
|
MD5 | fc8cd4a49e636133ddefe6eacca1c10a |
|
BLAKE2b-256 | 6f63b2070ab1f3e11709aa090f6f091e289c9c056ee42c62659da70b671481d7 |
File details
Details for the file qcs_sdk_python-0.20.1-cp310-none-win_amd64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp310-none-win_amd64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cccdf4b1c2f4754495b58f26f8bac2195fdb2d08d830dd1509126b0e14dc035 |
|
MD5 | 664014b658508c3f7c1c2cde04632db1 |
|
BLAKE2b-256 | 62679731d0916421e8dcbf016968d5e59ec9a6e8d477bc3b412ee269c047a85b |
File details
Details for the file qcs_sdk_python-0.20.1-cp310-cp310-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cee00557121a2a6bab18cbf5b13db82b5776a48d68c370699434a2b4d96c2733 |
|
MD5 | 470efd8059c062ee16399ec2c2861b94 |
|
BLAKE2b-256 | 86f63ad289e36d8323a856a00cf4e548bb5f3499ac564eeb93cc67a2c4806361 |
File details
Details for the file qcs_sdk_python-0.20.1-cp310-cp310-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp310-cp310-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7557eb7b7de5faa98d3abe301875f658eec8a61b80360d4e838e22ca25ba5e40 |
|
MD5 | 40b7979b48f617d3bab6b6b55224c109 |
|
BLAKE2b-256 | b6ef7fed35810e6cee89f95b5e738b146073166b797164179d2511285fb0883c |
File details
Details for the file qcs_sdk_python-0.20.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.10, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e2584ee489ec931202f0b2f9b9b962eef10277d8b1a758ce62375336d7a7b1 |
|
MD5 | c857f4755904c7aa6decda8598f3d0be |
|
BLAKE2b-256 | ba3451c0e04b6d201d142bf640fd9c72c449603e91cf4a7d3694980d5e352562 |
File details
Details for the file qcs_sdk_python-0.20.1-cp39-none-win_amd64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp39-none-win_amd64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86c75efc6a788863f56f7c06f5b0dc3319ec71548a74900721ca5b7d8bd429d0 |
|
MD5 | 3ee8e0b73f8247ba2bb7c37a00004ee5 |
|
BLAKE2b-256 | 26d7dcdf9e0c544fe90acb656c0b8b78df08944a5400af95f31afdacd7dd5a7b |
File details
Details for the file qcs_sdk_python-0.20.1-cp39-cp39-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c83e8d0fe69dbf90d6b4e542d0538fda92b9a9d64db0d8cbb0ea5af09d46815 |
|
MD5 | eaf1b04920b3a6f75751b12e25e3592f |
|
BLAKE2b-256 | 27fc62e7b138305f7a2fc9af7d07ae78eb24dc5ecc15324a836c96f686e4694c |
File details
Details for the file qcs_sdk_python-0.20.1-cp39-cp39-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp39-cp39-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2753f513cac1d60e2e2d1c6069c12d4f2dd41f57e3914469ed804ab2568305cb |
|
MD5 | d045a190833e09481808785c898dd776 |
|
BLAKE2b-256 | bdfafa5f735887a7ccf3859e5beb53d0dc753072efca62e1f65e0ef8e6912263 |
File details
Details for the file qcs_sdk_python-0.20.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.9, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9edce0372b40bd050c72b2ec8021d3ec1692a8f909181f72e783ace5fb6943a |
|
MD5 | b53e33a3ae86b1e2944bd7fd6a3d9ebd |
|
BLAKE2b-256 | 4638b923e2bf40c01e92677dea4de33944f5c9f049f850455a20249ecfbadfec |
File details
Details for the file qcs_sdk_python-0.20.1-cp38-none-win_amd64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp38-none-win_amd64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f47a4fe8532ed6faf812ea8c1d0607130d598e1ad04944f12cc6968ec27473d |
|
MD5 | 86b4399b91782dc9dd4f3a4bba382546 |
|
BLAKE2b-256 | 0675a8ee743b9f41c6201d26ea3faf146b1814a0740726e7e74aa2081b6da0d2 |
File details
Details for the file qcs_sdk_python-0.20.1-cp38-cp38-manylinux_2_28_x86_64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 7.0 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c232ae7ccbf3dae4726dac453e932305fe721124c38ab8d49d68c04d1d4a9468 |
|
MD5 | 8fec6d39399d041d50ab553db431a925 |
|
BLAKE2b-256 | e160265e814c3e77cc8c6799b525bcec468d056ef57eaf96972442bd8e344d0d |
File details
Details for the file qcs_sdk_python-0.20.1-cp38-cp38-manylinux_2_28_aarch64.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp38-cp38-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 6.6 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14d1a30af213e532df5f64d23e650fb8ed517df89da0ba40da3f474a88e3ac2a |
|
MD5 | 04792a152db8c0c1f95ff196f04cf683 |
|
BLAKE2b-256 | 52adc477b678280143dcf4154d0a287a22a9e949be3a7ff53c43d42f94ef2e2d |
File details
Details for the file qcs_sdk_python-0.20.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
.
File metadata
- Download URL: qcs_sdk_python-0.20.1-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.8, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: maturin/1.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d58b6ae03dd6d77c34d54c3f8d75a3e434efcf4b8d09f2265d16f276aa83ffb |
|
MD5 | 54ef1fb9ce0fcbce625ca7a06e79165e |
|
BLAKE2b-256 | efea71aaf995697f4aa9b75e2dcb81cefed1d445e790ddefd057a902617bffe1 |