qcs-sdk-python 0.26.0__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- README-py.md +111 -0
- THIRDPARTY.yaml +40894 -0
- qcs_sdk/__init__.py +23 -0
- qcs_sdk/__init__.pyi +441 -0
- qcs_sdk/_qcs_sdk.cp313-win_amd64.pyd +0 -0
- qcs_sdk/_tracing_subscriber/.stubtest-allowlist +7 -0
- qcs_sdk/_tracing_subscriber/__init__.py +17 -0
- qcs_sdk/_tracing_subscriber/__init__.pyi +131 -0
- qcs_sdk/_tracing_subscriber/common/__init__.py +18 -0
- qcs_sdk/_tracing_subscriber/common/__init__.pyi +46 -0
- qcs_sdk/_tracing_subscriber/layers/__init__.py +18 -0
- qcs_sdk/_tracing_subscriber/layers/__init__.pyi +30 -0
- qcs_sdk/_tracing_subscriber/layers/file/__init__.py +19 -0
- qcs_sdk/_tracing_subscriber/layers/file/__init__.pyi +42 -0
- qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.py +18 -0
- qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.pyi +118 -0
- qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.py +18 -0
- qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.pyi +38 -0
- qcs_sdk/_tracing_subscriber/subscriber/__init__.py +18 -0
- qcs_sdk/_tracing_subscriber/subscriber/__init__.pyi +25 -0
- qcs_sdk/client.pyi +124 -0
- qcs_sdk/compiler/__init__.pyi +5 -0
- qcs_sdk/compiler/quilc.pyi +316 -0
- qcs_sdk/diagnostics.pyi +36 -0
- qcs_sdk/qpu/__init__.pyi +216 -0
- qcs_sdk/qpu/api.pyi +484 -0
- qcs_sdk/qpu/experimental/__init__.pyi +5 -0
- qcs_sdk/qpu/experimental/random.pyi +98 -0
- qcs_sdk/qpu/isa.pyi +472 -0
- qcs_sdk/qpu/translation.pyi +180 -0
- qcs_sdk/qvm/__init__.pyi +162 -0
- qcs_sdk/qvm/api.pyi +236 -0
- qcs_sdk_python-0.26.0.dist-info/METADATA +130 -0
- qcs_sdk_python-0.26.0.dist-info/RECORD +36 -0
- qcs_sdk_python-0.26.0.dist-info/WHEEL +4 -0
- qcs_sdk_python-0.26.0.dist-info/sboms/qcs.cyclonedx.json +19204 -0
qcs_sdk/qvm/__init__.pyi
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# This file is automatically generated by pyo3_stub_gen
|
|
2
|
+
# ruff: noqa: E501, F401
|
|
3
|
+
|
|
4
|
+
import builtins
|
|
5
|
+
import collections.abc
|
|
6
|
+
import typing
|
|
7
|
+
from qcs_sdk import QcsSdkError, RegisterData, RegisterMap
|
|
8
|
+
from qcs_sdk.qvm.api import AddressRequest
|
|
9
|
+
from . import api
|
|
10
|
+
|
|
11
|
+
@typing.final
|
|
12
|
+
class QVMClient:
|
|
13
|
+
r"""
|
|
14
|
+
Client used to communicate with QVM.
|
|
15
|
+
"""
|
|
16
|
+
@property
|
|
17
|
+
def qvm_url(self) -> builtins.str:
|
|
18
|
+
r"""
|
|
19
|
+
Return the address of the client.
|
|
20
|
+
"""
|
|
21
|
+
def __new__(cls) -> QVMClient: ...
|
|
22
|
+
@staticmethod
|
|
23
|
+
def new_http(endpoint: builtins.str) -> QVMClient:
|
|
24
|
+
r"""
|
|
25
|
+
Construct a new QVM client which uses HTTP to communicate with a QVM service.
|
|
26
|
+
"""
|
|
27
|
+
@staticmethod
|
|
28
|
+
def new_libquil() -> QVMClient: ...
|
|
29
|
+
|
|
30
|
+
class QVMError(QcsSdkError):
|
|
31
|
+
r"""
|
|
32
|
+
Errors that can occur when running a Quil program on QVM.
|
|
33
|
+
"""
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
@typing.final
|
|
37
|
+
class QVMOptions:
|
|
38
|
+
r"""
|
|
39
|
+
Options avaialable for running programs on the QVM.
|
|
40
|
+
"""
|
|
41
|
+
@property
|
|
42
|
+
def timeout(self) -> typing.Optional[builtins.float]:
|
|
43
|
+
r"""
|
|
44
|
+
The timeout used for requests to the QVM. If set to None, there is no timeout.
|
|
45
|
+
"""
|
|
46
|
+
@timeout.setter
|
|
47
|
+
def timeout(self, value: typing.Optional[builtins.float]) -> None:
|
|
48
|
+
r"""
|
|
49
|
+
The timeout used for requests to the QVM. If set to None, there is no timeout.
|
|
50
|
+
"""
|
|
51
|
+
def __new__(cls, timeout_seconds: typing.Optional[builtins.float] = None) -> QVMOptions: ...
|
|
52
|
+
def __repr__(self) -> builtins.str:
|
|
53
|
+
r"""
|
|
54
|
+
Implements `__repr__` for Python in terms of the Rust
|
|
55
|
+
[`Debug`](std::fmt::Debug) implementation.
|
|
56
|
+
"""
|
|
57
|
+
@staticmethod
|
|
58
|
+
def default() -> QVMOptions:
|
|
59
|
+
r"""
|
|
60
|
+
Get the default set of ``QVMOptions`` used for QVM requests.
|
|
61
|
+
|
|
62
|
+
Settings:
|
|
63
|
+
timeout: 30.0 seconds
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
@typing.final
|
|
67
|
+
class QVMResultData:
|
|
68
|
+
r"""
|
|
69
|
+
Encapsulates data returned after running a program on the QVM
|
|
70
|
+
"""
|
|
71
|
+
@property
|
|
72
|
+
def memory(self) -> builtins.dict[builtins.str, RegisterData]:
|
|
73
|
+
r"""
|
|
74
|
+
A map of register names (ie. "ro") to a `RegisterData` containing their values.
|
|
75
|
+
"""
|
|
76
|
+
def __getnewargs__(self) -> tuple[builtins.dict[builtins.str, RegisterData]]: ...
|
|
77
|
+
def __new__(cls, memory: typing.Mapping[builtins.str, RegisterData]) -> QVMResultData:
|
|
78
|
+
r"""
|
|
79
|
+
Build a ``QVMResultData`` from a mapping of register names to a ``RegisterData`` matrix.
|
|
80
|
+
"""
|
|
81
|
+
def __repr__(self) -> builtins.str:
|
|
82
|
+
r"""
|
|
83
|
+
Implements `__repr__` for Python in terms of the Rust
|
|
84
|
+
[`Debug`](std::fmt::Debug) implementation.
|
|
85
|
+
"""
|
|
86
|
+
@staticmethod
|
|
87
|
+
def from_memory_map(memory: typing.Mapping[builtins.str, RegisterData]) -> QVMResultData:
|
|
88
|
+
r"""
|
|
89
|
+
Build a [`QvmResultData`] from a mapping of register names to a [`RegisterData`]
|
|
90
|
+
"""
|
|
91
|
+
def to_raw_readout_data(self) -> RawQVMReadoutData:
|
|
92
|
+
r"""
|
|
93
|
+
Get a copy of this result data flattened into a ``RawQVMReadoutData``.
|
|
94
|
+
"""
|
|
95
|
+
def to_register_map(self) -> RegisterMap:
|
|
96
|
+
r"""
|
|
97
|
+
Convert into a [`RegisterMap`].
|
|
98
|
+
|
|
99
|
+
The [`RegisterMatrix`] for each register will be
|
|
100
|
+
constructed such that each row contains all the final values in the register for a single shot.
|
|
101
|
+
|
|
102
|
+
# Errors
|
|
103
|
+
|
|
104
|
+
Returns a [`RegisterMatrixConversionError`] if the inner execution data for any of the
|
|
105
|
+
registers would result in a jagged matrix.
|
|
106
|
+
This is often the case in programs that use mid-circuit measurement or dynamic control flow,
|
|
107
|
+
where measurements to the same memory reference might occur multiple times in a shot, or be
|
|
108
|
+
skipped conditionally. In these cases, building a rectangular [`RegisterMatrix`] would
|
|
109
|
+
necessitate making assumptions about the data that could skew the data in undesirable ways.
|
|
110
|
+
Instead, it's recommended to manually build a matrix from [`QpuResultData`] that accurately
|
|
111
|
+
selects the last value per-shot based on the program that was run.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
@typing.final
|
|
115
|
+
class RawQVMReadoutData:
|
|
116
|
+
r"""
|
|
117
|
+
Encapsulates raw data returned from the QVM after executing a program.
|
|
118
|
+
"""
|
|
119
|
+
@property
|
|
120
|
+
def memory(self) -> builtins.dict[builtins.str, list]:
|
|
121
|
+
r"""
|
|
122
|
+
The mapping of register names (ie. "ro") to a 2-d list containing the
|
|
123
|
+
values for that register.
|
|
124
|
+
"""
|
|
125
|
+
def __repr__(self) -> builtins.str:
|
|
126
|
+
r"""
|
|
127
|
+
Implements `__repr__` for Python in terms of the Rust
|
|
128
|
+
[`Debug`](std::fmt::Debug) implementation.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
def run(quil: builtins.str, shots: builtins.int, addresses: typing.Mapping[builtins.str, AddressRequest], params: typing.Mapping[builtins.str, typing.Sequence[builtins.float]], client: QVMClient, measurement_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, gate_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, rng_seed: typing.Optional[builtins.int] = None, options: typing.Optional[QVMOptions] = None) -> QVMResultData:
|
|
132
|
+
r"""
|
|
133
|
+
Runs the given program on the QVM.
|
|
134
|
+
|
|
135
|
+
:param quil: A quil program as a string.
|
|
136
|
+
:param shots: The number of times to run the program. Should be a value greater than zero.
|
|
137
|
+
:param addresses: A mapping of memory region names to an ``AddressRequest`` describing what data to get back for that memory region from the QVM at the end of execution.
|
|
138
|
+
:param params: A mapping of memory region names to their desired values.
|
|
139
|
+
:param client: An optional ``QCSClient`` to use. If unset, creates one using the environemnt configuration (see https://docs.rigetti.com/qcs/references/qcs-client-configuration).
|
|
140
|
+
:param options: An optional ``QVMOptions`` to use. If unset, uses ``QVMOptions.default()`` for the request.
|
|
141
|
+
|
|
142
|
+
:returns: A ``QVMResultData`` containing the final state of of memory for the requested readouts after the program finished running.
|
|
143
|
+
|
|
144
|
+
:raises QVMError: If one of the parameters is invalid, or if there was a problem communicating with the QVM server.
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
def run_async(quil: builtins.str, shots: builtins.int, addresses: typing.Mapping[builtins.str, AddressRequest], params: typing.Mapping[builtins.str, typing.Sequence[builtins.float]], client: QVMClient, measurement_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, gate_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, rng_seed: typing.Optional[builtins.int] = None, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[QVMResultData]:
|
|
148
|
+
r"""
|
|
149
|
+
Runs the given program on the QVM.
|
|
150
|
+
|
|
151
|
+
:param quil: A quil program as a string.
|
|
152
|
+
:param shots: The number of times to run the program. Should be a value greater than zero.
|
|
153
|
+
:param addresses: A mapping of memory region names to an ``AddressRequest`` describing what data to get back for that memory region from the QVM at the end of execution.
|
|
154
|
+
:param params: A mapping of memory region names to their desired values.
|
|
155
|
+
:param client: An optional ``QCSClient`` to use. If unset, creates one using the environemnt configuration (see https://docs.rigetti.com/qcs/references/qcs-client-configuration).
|
|
156
|
+
:param options: An optional ``QVMOptions`` to use. If unset, uses ``QVMOptions.default()`` for the request.
|
|
157
|
+
|
|
158
|
+
:returns: A ``QVMResultData`` containing the final state of of memory for the requested readouts after the program finished running.
|
|
159
|
+
|
|
160
|
+
:raises QVMError: If one of the parameters is invalid, or if there was a problem communicating with the QVM server.
|
|
161
|
+
"""
|
|
162
|
+
|
qcs_sdk/qvm/api.pyi
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# This file is automatically generated by pyo3_stub_gen
|
|
2
|
+
# ruff: noqa: E501, F401
|
|
3
|
+
|
|
4
|
+
import builtins
|
|
5
|
+
import collections.abc
|
|
6
|
+
import typing
|
|
7
|
+
from qcs_sdk import RegisterData
|
|
8
|
+
from qcs_sdk.qvm import QVMClient, QVMOptions
|
|
9
|
+
|
|
10
|
+
class AddressRequest:
|
|
11
|
+
r"""
|
|
12
|
+
An enum encapsulating the different ways to request data back from the QVM for an address.
|
|
13
|
+
"""
|
|
14
|
+
@typing.final
|
|
15
|
+
class ExcludeAll(AddressRequest):
|
|
16
|
+
r"""
|
|
17
|
+
Exclude all values for the address.
|
|
18
|
+
"""
|
|
19
|
+
__match_args__ = ()
|
|
20
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
21
|
+
def __len__(self) -> builtins.int: ...
|
|
22
|
+
def __new__(cls) -> AddressRequest.ExcludeAll: ...
|
|
23
|
+
|
|
24
|
+
@typing.final
|
|
25
|
+
class IncludeAll(AddressRequest):
|
|
26
|
+
r"""
|
|
27
|
+
Get all values for the address.
|
|
28
|
+
"""
|
|
29
|
+
__match_args__ = ()
|
|
30
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
31
|
+
def __len__(self) -> builtins.int: ...
|
|
32
|
+
def __new__(cls) -> AddressRequest.IncludeAll: ...
|
|
33
|
+
|
|
34
|
+
@typing.final
|
|
35
|
+
class Indices(AddressRequest):
|
|
36
|
+
r"""
|
|
37
|
+
A list of specific indices to get back for the address.
|
|
38
|
+
"""
|
|
39
|
+
__match_args__ = ("_0",)
|
|
40
|
+
@property
|
|
41
|
+
def _0(self) -> builtins.list[builtins.int]: ...
|
|
42
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
43
|
+
def __len__(self) -> builtins.int: ...
|
|
44
|
+
def __new__(cls, _0: typing.Sequence[builtins.int]) -> AddressRequest.Indices: ...
|
|
45
|
+
|
|
46
|
+
...
|
|
47
|
+
|
|
48
|
+
@typing.final
|
|
49
|
+
class ExpectationRequest:
|
|
50
|
+
r"""
|
|
51
|
+
The request body needed for a [`measure_expectation`] request to the QVM.
|
|
52
|
+
"""
|
|
53
|
+
@property
|
|
54
|
+
def operators(self) -> builtins.list[builtins.str]:
|
|
55
|
+
r"""
|
|
56
|
+
A list of Pauli operators to measure.
|
|
57
|
+
"""
|
|
58
|
+
@property
|
|
59
|
+
def rng_seed(self) -> typing.Optional[builtins.int]:
|
|
60
|
+
r"""
|
|
61
|
+
An optional seed for the random number generator.
|
|
62
|
+
"""
|
|
63
|
+
@property
|
|
64
|
+
def state_preparation(self) -> builtins.str:
|
|
65
|
+
r"""
|
|
66
|
+
A Quil program defining the state.
|
|
67
|
+
"""
|
|
68
|
+
def __new__(cls, state_preparation: builtins.str, operators: typing.Sequence[builtins.str], rng_seed: typing.Optional[builtins.int] = None) -> ExpectationRequest:
|
|
69
|
+
r"""
|
|
70
|
+
Creates a new `ExpectationRequest` using the given parameters.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
@typing.final
|
|
74
|
+
class MultishotMeasureRequest:
|
|
75
|
+
r"""
|
|
76
|
+
The request body needed for a [`run_and_measure`] request to the QVM.
|
|
77
|
+
"""
|
|
78
|
+
@property
|
|
79
|
+
def compiled_quil(self) -> builtins.str:
|
|
80
|
+
r"""
|
|
81
|
+
The Quil program to run.
|
|
82
|
+
"""
|
|
83
|
+
@property
|
|
84
|
+
def gate_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
85
|
+
r"""
|
|
86
|
+
Simulated gate noise for the X, Y, and Z axes.
|
|
87
|
+
"""
|
|
88
|
+
@property
|
|
89
|
+
def measurement_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
90
|
+
r"""
|
|
91
|
+
Simulated measurement noise for the X, Y, and Z axes.
|
|
92
|
+
"""
|
|
93
|
+
@property
|
|
94
|
+
def qubits(self) -> builtins.list[builtins.int]:
|
|
95
|
+
r"""
|
|
96
|
+
Qubits to measure
|
|
97
|
+
"""
|
|
98
|
+
@property
|
|
99
|
+
def rng_seed(self) -> typing.Optional[builtins.int]:
|
|
100
|
+
r"""
|
|
101
|
+
An optional seed for the random number generator.
|
|
102
|
+
"""
|
|
103
|
+
@property
|
|
104
|
+
def trials(self) -> builtins.int: ...
|
|
105
|
+
@trials.setter
|
|
106
|
+
def trials(self, value: builtins.int) -> None: ...
|
|
107
|
+
def __new__(cls, compiled_quil: builtins.str, trials: builtins.int, qubits: builtins.list[builtins.int], measurement_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, gate_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, rng_seed: typing.Optional[builtins.int] = None) -> MultishotMeasureRequest:
|
|
108
|
+
r"""
|
|
109
|
+
Construct a new `MultishotMeasureRequest` using the given parameters.
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
@typing.final
|
|
113
|
+
class MultishotRequest:
|
|
114
|
+
r"""
|
|
115
|
+
The request body needed to make a multishot [`run`] request to the QVM.
|
|
116
|
+
"""
|
|
117
|
+
@property
|
|
118
|
+
def addresses(self) -> builtins.dict[builtins.str, AddressRequest]:
|
|
119
|
+
r"""
|
|
120
|
+
The memory regions to include in the response.
|
|
121
|
+
"""
|
|
122
|
+
@addresses.setter
|
|
123
|
+
def addresses(self, value: builtins.dict[builtins.str, AddressRequest]) -> None:
|
|
124
|
+
r"""
|
|
125
|
+
The memory regions to include in the response.
|
|
126
|
+
"""
|
|
127
|
+
@property
|
|
128
|
+
def compiled_quil(self) -> builtins.str:
|
|
129
|
+
r"""
|
|
130
|
+
The Quil program to run.
|
|
131
|
+
"""
|
|
132
|
+
@compiled_quil.setter
|
|
133
|
+
def compiled_quil(self, value: builtins.str) -> None:
|
|
134
|
+
r"""
|
|
135
|
+
The Quil program to run.
|
|
136
|
+
"""
|
|
137
|
+
@property
|
|
138
|
+
def gate_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
139
|
+
r"""
|
|
140
|
+
Simulated gate noise for the X, Y, and Z axes.
|
|
141
|
+
"""
|
|
142
|
+
@gate_noise.setter
|
|
143
|
+
def gate_noise(self, value: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]) -> None:
|
|
144
|
+
r"""
|
|
145
|
+
Simulated gate noise for the X, Y, and Z axes.
|
|
146
|
+
"""
|
|
147
|
+
@property
|
|
148
|
+
def measurement_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
149
|
+
r"""
|
|
150
|
+
Simulated measurement noise for the X, Y, and Z axes.
|
|
151
|
+
"""
|
|
152
|
+
@measurement_noise.setter
|
|
153
|
+
def measurement_noise(self, value: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]) -> None:
|
|
154
|
+
r"""
|
|
155
|
+
Simulated measurement noise for the X, Y, and Z axes.
|
|
156
|
+
"""
|
|
157
|
+
@property
|
|
158
|
+
def rng_seed(self) -> typing.Optional[builtins.int]:
|
|
159
|
+
r"""
|
|
160
|
+
An optional seed for the random number generator.
|
|
161
|
+
"""
|
|
162
|
+
@rng_seed.setter
|
|
163
|
+
def rng_seed(self, value: typing.Optional[builtins.int]) -> None:
|
|
164
|
+
r"""
|
|
165
|
+
An optional seed for the random number generator.
|
|
166
|
+
"""
|
|
167
|
+
@property
|
|
168
|
+
def trials(self) -> builtins.int: ...
|
|
169
|
+
@trials.setter
|
|
170
|
+
def trials(self, value: builtins.int) -> None: ...
|
|
171
|
+
def __new__(cls, program: builtins.str, shots: builtins.int, addresses: typing.Mapping[builtins.str, AddressRequest], measurement_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, gate_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, rng_seed: typing.Optional[builtins.int] = None) -> MultishotRequest:
|
|
172
|
+
r"""
|
|
173
|
+
Creates a new `MultishotRequest` with the given parameters.
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
@typing.final
|
|
177
|
+
class MultishotResponse:
|
|
178
|
+
r"""
|
|
179
|
+
The response body returned by the QVM after a multishot [`run`] request.
|
|
180
|
+
"""
|
|
181
|
+
@property
|
|
182
|
+
def registers(self) -> builtins.dict[builtins.str, RegisterData]:
|
|
183
|
+
r"""
|
|
184
|
+
The requested readout registers and their final values for each shot.
|
|
185
|
+
"""
|
|
186
|
+
|
|
187
|
+
@typing.final
|
|
188
|
+
class WavefunctionRequest:
|
|
189
|
+
r"""
|
|
190
|
+
The request body needed to make a [`get_wavefunction`] request to the QVM.
|
|
191
|
+
"""
|
|
192
|
+
@property
|
|
193
|
+
def compiled_quil(self) -> builtins.str:
|
|
194
|
+
r"""
|
|
195
|
+
The Quil program to run.
|
|
196
|
+
"""
|
|
197
|
+
@property
|
|
198
|
+
def gate_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
199
|
+
r"""
|
|
200
|
+
Simulated gate noise for the X, Y, and Z axes.
|
|
201
|
+
"""
|
|
202
|
+
@property
|
|
203
|
+
def measurement_noise(self) -> typing.Optional[tuple[builtins.float, builtins.float, builtins.float]]:
|
|
204
|
+
r"""
|
|
205
|
+
Simulated measurement noise for the X, Y, and Z axes.
|
|
206
|
+
"""
|
|
207
|
+
@property
|
|
208
|
+
def rng_seed(self) -> typing.Optional[builtins.int]:
|
|
209
|
+
r"""
|
|
210
|
+
An optional seed for the random number generator.
|
|
211
|
+
"""
|
|
212
|
+
def __new__(cls, compiled_quil: builtins.str, measurement_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, gate_noise: typing.Optional[tuple[builtins.float, builtins.float, builtins.float]] = None, rng_seed: typing.Optional[builtins.int] = None) -> WavefunctionRequest:
|
|
213
|
+
r"""
|
|
214
|
+
Create a new `WavefunctionRequest` with the given parameters.
|
|
215
|
+
"""
|
|
216
|
+
|
|
217
|
+
def get_version_info(client: QVMClient, options: typing.Optional[QVMOptions] = None) -> builtins.str: ...
|
|
218
|
+
|
|
219
|
+
def get_version_info_async(client: QVMClient, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[builtins.str]: ...
|
|
220
|
+
|
|
221
|
+
def get_wavefunction(request: WavefunctionRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> builtins.list[builtins.int]: ...
|
|
222
|
+
|
|
223
|
+
def get_wavefunction_async(request: WavefunctionRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[builtins.list[builtins.int]]: ...
|
|
224
|
+
|
|
225
|
+
def measure_expectation(request: ExpectationRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> builtins.list[builtins.float]: ...
|
|
226
|
+
|
|
227
|
+
def measure_expectation_async(request: ExpectationRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[builtins.list[builtins.float]]: ...
|
|
228
|
+
|
|
229
|
+
def run(request: MultishotRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> MultishotResponse: ...
|
|
230
|
+
|
|
231
|
+
def run_and_measure(request: MultishotMeasureRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> builtins.list[builtins.list[builtins.int]]: ...
|
|
232
|
+
|
|
233
|
+
def run_and_measure_async(request: MultishotMeasureRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[builtins.list[builtins.list[builtins.int]]]: ...
|
|
234
|
+
|
|
235
|
+
def run_async(request: MultishotRequest, client: QVMClient, options: typing.Optional[QVMOptions] = None) -> collections.abc.Awaitable[MultishotResponse]: ...
|
|
236
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: qcs-sdk-python
|
|
3
|
+
Version: 0.26.0
|
|
4
|
+
Classifier: Development Status :: 3 - Alpha
|
|
5
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
6
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Dist: quil>=0.35.0,<0.36.0
|
|
12
|
+
Requires-Dist: qcs-api-client-common>=0.15.0,<0.16.0
|
|
13
|
+
Summary: Python interface for the QCS Rust SDK
|
|
14
|
+
Author-email: Rigetti Computing <softapps@rigetti.com>, Mark Skilbeck <mark.skilbeck@rigetti.com>, Marquess Valdez <mvaldez@rigetti.com>, Randall Fulton <rfulton@rigetti.com>
|
|
15
|
+
License: Apache-2.0
|
|
16
|
+
Requires-Python: >=3.10, <4
|
|
17
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
|
+
|
|
19
|
+
# QCS SDK Python
|
|
20
|
+
|
|
21
|
+
⚠️ In Development
|
|
22
|
+
|
|
23
|
+
`qcs-sdk-python` provides an interface to Rigetti [Quantum Cloud Services](https://docs.rigetti.com/qcs/) (QCS), allowing users
|
|
24
|
+
to compile and run Quil programs on Rigetti quantum processors. Internally, it is powered by the [QCS Rust SDK](https://github.com/rigetti/qcs-sdk-rust).
|
|
25
|
+
|
|
26
|
+
While this package can be used directly, [pyQuil](https://pypi.org/project/pyquil/) offers more functionality and a
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
# Documentation
|
|
30
|
+
|
|
31
|
+
Documentation for the current release of `qcs_sdk` is published [here](https://rigetti.github.io/qcs-sdk-rust/qcs_sdk.html). Every version of `qcs_sdk` ships [with type stubs](https://github.com/rigetti/qcs-sdk-rust/tree/main/crates/lib/python/qcs_sdk) that can provide type hints and documentation to Python tooling and editors.
|
|
32
|
+
|
|
33
|
+
## Troubleshooting
|
|
34
|
+
|
|
35
|
+
### Enabling Debug logging
|
|
36
|
+
|
|
37
|
+
This package integrates with Python's [logging facility](https://docs.python.org/3/library/logging.html) through a Rust crate called [`pyo3_log`](https://docs.rs/pyo3-log/latest/pyo3_log/). The quickest way to get started is to just enable debug logging:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import logging
|
|
41
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Because this is implemented with Rust, there are some important differences in regards to log levels and filtering.
|
|
45
|
+
|
|
46
|
+
#### The `TRACE` log level
|
|
47
|
+
|
|
48
|
+
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:
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import logging
|
|
52
|
+
logging.basicConfig(level=5)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Runtime Configuration and Caching
|
|
56
|
+
|
|
57
|
+
`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](https://docs.rs/pyo3-log/latest/pyo3_log/#performance-filtering-and-caching) goes into more detail.
|
|
58
|
+
|
|
59
|
+
These caches can be reset using the following:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
qcs_sdk.reset_logging()
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This will allow the logging handlers to pick up the most recently-applied configuration from the Python side.
|
|
66
|
+
|
|
67
|
+
#### Filtering Logs
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
For example, say you wanted to disable the following log:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
DEBUG:hyper.proto.h1.io:flushed 124 bytes
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You could get the logger for `hyper.proto.h1.io` and disable it like so:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
logging.getLogger("hyper.proto.h1.io").disabled = True
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
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:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
class QCSLogFilter(logging.Filter):
|
|
87
|
+
def filter(self, record) -> bool:
|
|
88
|
+
return "qcs" in record.name
|
|
89
|
+
|
|
90
|
+
for handler in logging.root.handlers:
|
|
91
|
+
handler.addFilter(QCSLogFilter())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
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.
|
|
95
|
+
|
|
96
|
+
#### OpenTelemetry Integration
|
|
97
|
+
|
|
98
|
+
This package supports collection of [OpenTelemetry trace data](https://opentelemetry.io/docs/concepts/signals/traces/). Clients may configure any OpenTelemetry [collector](https://opentelemetry.io/docs/collector/) that supports the [OTLP Specification](https://opentelemetry.io/docs/specs/otlp/). _Rigetti will not have access to the OpenTelemetry data you collect_.
|
|
99
|
+
|
|
100
|
+
To enable the integration, you should install the `qcs-sdk[tracing-opentelemetry]` extra; this installs [opentelemetry-api](https://pypi.org/project/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](https://crates.io/crates/pyo3-tracing-subscriber) to configure collection of your client network requests. See `qcs_sdk._tracing_subscriber` module level documentation for more detail.
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
import my_module
|
|
104
|
+
from qcs_sdk._tracing_subscriber import (
|
|
105
|
+
GlobalTracingConfig,
|
|
106
|
+
SimpleConfig,
|
|
107
|
+
Tracing,
|
|
108
|
+
subscriber,
|
|
109
|
+
)
|
|
110
|
+
from qcs_sdk._tracing_subscriber.layers import otel_otlp
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def main():
|
|
114
|
+
tracing_configuration = GlobalTracingConfig(
|
|
115
|
+
export_process=SimpleConfig(
|
|
116
|
+
subscriber=subscriber.Config(
|
|
117
|
+
# By default this supports the standard OTLP environment variables.
|
|
118
|
+
# See https://opentelemetry.io/docs/specs/otel/protocol/exporter/
|
|
119
|
+
layer=otel_otlp.Config()
|
|
120
|
+
)
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
with Tracing(config=config):
|
|
124
|
+
result = my_module.example_function()
|
|
125
|
+
my_module.other_example_function(result)
|
|
126
|
+
|
|
127
|
+
if __name__ == '__main__':
|
|
128
|
+
main()
|
|
129
|
+
```
|
|
130
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
README-py.md,sha256=wkf42RAgilHm1Ey9iOQfhud8r-o3fx71J7m1IaK0hPc,5458
|
|
2
|
+
THIRDPARTY.yaml,sha256=_E47ATBDhoCUSeXFv8Lu6lnC0iKe_PpbQdcm8EJcuW0,3843414
|
|
3
|
+
qcs_sdk/__init__.py,sha256=h9n3keETqxXFnYOE1eTXYigAxGffw17sSHd1IG3C3lE,851
|
|
4
|
+
qcs_sdk/__init__.pyi,sha256=Ps00JgVcKF4oh2ZMJSuOyIWC30NaJfbf7aLU7PIttOI,18833
|
|
5
|
+
qcs_sdk/_qcs_sdk.cp313-win_amd64.pyd,sha256=wXUx2DzzOxSb1-6UgCVCCRfUcncXP3wMhoYaw-Io_88,23383040
|
|
6
|
+
qcs_sdk/_tracing_subscriber/.stubtest-allowlist,sha256=u1H1N-VH0rrwrhrqGdmb0mtL8gKYhZ9lHx6CN3y4TVI,346
|
|
7
|
+
qcs_sdk/_tracing_subscriber/__init__.py,sha256=qDCV2SV3SEMMM7aJLX12GTmEIQPFowJ8DqxxFcaATXw,1032
|
|
8
|
+
qcs_sdk/_tracing_subscriber/__init__.pyi,sha256=5NUfBcwUJ4JcyY-mV93nw8OmyQHAkIUzO96EG-9XD2o,4838
|
|
9
|
+
qcs_sdk/_tracing_subscriber/common/__init__.py,sha256=UAgEm6x_ZNUNYm7Ws9h6ptMr0-vEfj0UoIUcVNGdmpc,1015
|
|
10
|
+
qcs_sdk/_tracing_subscriber/common/__init__.pyi,sha256=tNhe97M8D22FbXkmNVVU4Uk9qq-M0X6xTgMUvnG3b44,2131
|
|
11
|
+
qcs_sdk/_tracing_subscriber/layers/__init__.py,sha256=prNQQVxVhn23sHFDcz-iXdmH_Rrrsr3_deKIlJWkk24,1015
|
|
12
|
+
qcs_sdk/_tracing_subscriber/layers/__init__.pyi,sha256=fpFEDhfEd5bQk9BMo49VPYFLVH1g3oyV_wsT50lzC-0,1335
|
|
13
|
+
qcs_sdk/_tracing_subscriber/layers/file/__init__.py,sha256=jXgr55kJPcP33DOtVxRs6kmfj1dNfhwh-4DAO_56qzU,1018
|
|
14
|
+
qcs_sdk/_tracing_subscriber/layers/file/__init__.pyi,sha256=cD_wXxnweQWPX2Xc8qtwRN2KpC8hPmsgaZdcIFcgLGM,2305
|
|
15
|
+
qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.py,sha256=Ci1PFxlP8NP_b_dXgD8HiTiLyDs6lGb0w2LG_I6gqjg,1031
|
|
16
|
+
qcs_sdk/_tracing_subscriber/layers/otel_otlp/__init__.pyi,sha256=GdQfO80uKejXd8o751QrRycnAVI_ycGw1O_qBrF9f3Y,6012
|
|
17
|
+
qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.py,sha256=JoC0W1pZ_ldkrkVpW8NWtfrDboNW3970s_nBEetWrF0,1046
|
|
18
|
+
qcs_sdk/_tracing_subscriber/layers/otel_otlp_file/__init__.pyi,sha256=n-QJEqqrAQgI1CP2W_ANqHQ_WqubFIoXmxz5g6sPXLg,2259
|
|
19
|
+
qcs_sdk/_tracing_subscriber/subscriber/__init__.py,sha256=DEY-03lRFC25KKQ__vnN85Zvv1F7cujOTj5wSGEDpgU,1027
|
|
20
|
+
qcs_sdk/_tracing_subscriber/subscriber/__init__.pyi,sha256=HrW9wG_ycjBxQsD9JSveAC9kgxsRExFPCXQbzHJN-8s,1212
|
|
21
|
+
qcs_sdk/client.pyi,sha256=Vq9BoveELJYJZ_ULzasdFnnU2OVn1yg9uvswukCHMeI,4942
|
|
22
|
+
qcs_sdk/compiler/__init__.pyi,sha256=acfuDXFdFkWtoAHX79dV6YywowN-xrxvfc6h-JQ4VfQ,108
|
|
23
|
+
qcs_sdk/compiler/quilc.pyi,sha256=Of1fy1lc7rTF0hoZwAvvwCkM1aFH3URErTDj9WEnNkI,11899
|
|
24
|
+
qcs_sdk/diagnostics.pyi,sha256=f1BCiAfeKoUOrvYGG7wTHd97nwwH9V9Rj1SnLONw06g,1024
|
|
25
|
+
qcs_sdk/qpu/__init__.pyi,sha256=zgKsMrFVdDi12E-o2ljGCZ5qKgrvDedjvL5xUPyh1oQ,9627
|
|
26
|
+
qcs_sdk/qpu/api.pyi,sha256=YpmoY3lvUVVx8kRLCVu-qe_1ivmaPrsuzGQsLWFuqjc,24566
|
|
27
|
+
qcs_sdk/qpu/experimental/__init__.pyi,sha256=FZ34r9egG_is2rQB9swAu1zELyolZtbKmILajDrCVuU,109
|
|
28
|
+
qcs_sdk/qpu/experimental/random.pyi,sha256=peEo0ZXfKtO1hZMija0ohnDsPlmJUZYwnHl0qAZHhpI,3768
|
|
29
|
+
qcs_sdk/qpu/isa.pyi,sha256=y3pZl_djB2WO0cszZ_E8QTkPqhTTsW9gKgoAzbsTGy8,19920
|
|
30
|
+
qcs_sdk/qpu/translation.pyi,sha256=65Ry--0CE59i3SMOPvee52ga3JZx1b_WsKpkPNXAO1A,8549
|
|
31
|
+
qcs_sdk/qvm/__init__.pyi,sha256=QNLF22nr04K4rkcKHkHsIIKOJQv6EETm_O4yxmF8-Aw,7784
|
|
32
|
+
qcs_sdk/qvm/api.pyi,sha256=K7DgSzU0F2q0W5j06ovR4iKMg20yYiL0vuqgA7Cde9Q,9730
|
|
33
|
+
qcs_sdk_python-0.26.0.dist-info/METADATA,sha256=GcEHoXgy39L8WBsuGvfnqiRp_WaSR2b_yhWGqKXOQ8o,6304
|
|
34
|
+
qcs_sdk_python-0.26.0.dist-info/WHEEL,sha256=MeHAddfhFE43Hox4HMNv5ysU_Px_FPIOurt9DcMoh1g,97
|
|
35
|
+
qcs_sdk_python-0.26.0.dist-info/sboms/qcs.cyclonedx.json,sha256=ADZG5wZcIkYtuiQgusJJ4_2rf_2o8qTv88B8Ep3xKyk,636118
|
|
36
|
+
qcs_sdk_python-0.26.0.dist-info/RECORD,,
|