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/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""An interface to Rigetti [Quantum Cloud Services](https://docs.rigetti.com/qcs/) (QCS).
|
|
2
|
+
|
|
3
|
+
These APIs allow users to compile and run Quil programs on Rigetti quantum processors.
|
|
4
|
+
Internally, it is powered by the [QCS Rust SDK](https://github.com/rigetti/qcs-sdk-rust).
|
|
5
|
+
|
|
6
|
+
This package is still in development and breaking changes should be expected between minor versions.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from . import _qcs_sdk
|
|
10
|
+
from .client import QCSClient # noqa: re-export
|
|
11
|
+
|
|
12
|
+
_additional_exports = [
|
|
13
|
+
"QCSClient",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
# The following code exposes the package contents under the same namespace without the `_` prefix.
|
|
17
|
+
assert isinstance(_qcs_sdk.__all__, list) and all(isinstance(s, str) for s in _qcs_sdk.__all__)
|
|
18
|
+
exec(
|
|
19
|
+
f"from ._qcs_sdk import {', '.join(_qcs_sdk.__all__)}; "
|
|
20
|
+
f"__all__ = {_qcs_sdk.__all__ + _additional_exports}"
|
|
21
|
+
)
|
|
22
|
+
del _qcs_sdk
|
|
23
|
+
|
qcs_sdk/__init__.pyi
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
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 datetime
|
|
7
|
+
import enum
|
|
8
|
+
import numpy
|
|
9
|
+
import numpy.typing
|
|
10
|
+
import typing
|
|
11
|
+
from qcs_sdk.compiler.quilc import CompilerOpts, QuilcClient
|
|
12
|
+
from qcs_sdk.qpu import QPUResultData
|
|
13
|
+
from qcs_sdk.qpu.api import ExecutionOptions
|
|
14
|
+
from qcs_sdk.qpu.translation import TranslationOptions
|
|
15
|
+
from qcs_sdk.qvm import QVMClient, QVMResultData
|
|
16
|
+
from . import client
|
|
17
|
+
from . import compiler
|
|
18
|
+
from . import diagnostics
|
|
19
|
+
from . import qpu
|
|
20
|
+
from . import qvm
|
|
21
|
+
|
|
22
|
+
__version__: typing.Final[builtins.str]
|
|
23
|
+
@typing.final
|
|
24
|
+
class ExeParameter:
|
|
25
|
+
r"""
|
|
26
|
+
Program execution parameters.
|
|
27
|
+
|
|
28
|
+
Note: The validity of parameters is not checked until execution.
|
|
29
|
+
"""
|
|
30
|
+
@property
|
|
31
|
+
def index(self) -> builtins.int: ...
|
|
32
|
+
@index.setter
|
|
33
|
+
def index(self, value: builtins.int) -> None: ...
|
|
34
|
+
@property
|
|
35
|
+
def name(self) -> builtins.str: ...
|
|
36
|
+
@name.setter
|
|
37
|
+
def name(self, value: builtins.str) -> None: ...
|
|
38
|
+
@property
|
|
39
|
+
def value(self) -> builtins.float: ...
|
|
40
|
+
@value.setter
|
|
41
|
+
def value(self, value: builtins.float) -> None: ...
|
|
42
|
+
def __new__(cls, name: builtins.str, index: builtins.int, value: builtins.float) -> ExeParameter: ...
|
|
43
|
+
|
|
44
|
+
@typing.final
|
|
45
|
+
class Executable:
|
|
46
|
+
r"""
|
|
47
|
+
A builder interface for executing Quil programs on QVMs and QPUs.
|
|
48
|
+
|
|
49
|
+
# Example
|
|
50
|
+
|
|
51
|
+
This example executes a program on a QVM, specified by the `qvm_url` in the `QCSClient`:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from qcs_sdk import Executable
|
|
55
|
+
from qcs_sdk.client import QCSClient
|
|
56
|
+
from qcs_sdk.qvm import QVMClient
|
|
57
|
+
|
|
58
|
+
PROGRAM = r'''
|
|
59
|
+
DECLARE ro BIT[2]
|
|
60
|
+
|
|
61
|
+
H 0
|
|
62
|
+
CNOT 0 1
|
|
63
|
+
|
|
64
|
+
MEASURE 0 ro[0]
|
|
65
|
+
MEASURE 1 ro[1]
|
|
66
|
+
'''
|
|
67
|
+
|
|
68
|
+
async def run():
|
|
69
|
+
client = QVMClient.new_http(QCSClient.load().qvm_url)
|
|
70
|
+
result = await Executable(PROGRAM, shots=4).execute_on_qvm_async()
|
|
71
|
+
let data = result.result_data
|
|
72
|
+
.to_register_map()
|
|
73
|
+
.expect("should convert to readout map")
|
|
74
|
+
.get_register_matrix("ro")
|
|
75
|
+
.expect("should have data in ro")
|
|
76
|
+
.as_integer()
|
|
77
|
+
.expect("should be integer matrix")
|
|
78
|
+
.to_owned();
|
|
79
|
+
|
|
80
|
+
// In this case, we ran the program for 4 shots, so we know the number of rows is 4.
|
|
81
|
+
assert_eq!(data.nrows(), 4);
|
|
82
|
+
for shot in data.rows() {
|
|
83
|
+
// Each shot will contain all the memory, in order, for the vector (or "register") we
|
|
84
|
+
// requested the results of. In this case, "ro" (the default).
|
|
85
|
+
assert_eq!(shot.len(), 2);
|
|
86
|
+
// In the case of this particular program, we know ro[0] should equal ro[1]
|
|
87
|
+
assert_eq!(shot[0], shot[1]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
def main():
|
|
91
|
+
import asyncio
|
|
92
|
+
asyncio.run(run())
|
|
93
|
+
|
|
94
|
+
# "ro" is the only source read from by default if you don't specify `registers`.
|
|
95
|
+
|
|
96
|
+
# We first convert the readout data to a ``RegisterMap`` to get a mapping of registers
|
|
97
|
+
# (ie. "ro") to a [`RegisterMatrix`], `M`, where M[`shot`][`index`] is the value for
|
|
98
|
+
# the memory offset `index` during shot `shot`.
|
|
99
|
+
# There are some programs where QPU readout data does not fit into a [`RegisterMap`], in
|
|
100
|
+
# which case you should build the matrix you need from [`QpuResultData`] directly. See
|
|
101
|
+
# the [`RegisterMap`] documentation for more information on when this transformation
|
|
102
|
+
# might fail.
|
|
103
|
+
```
|
|
104
|
+
"""
|
|
105
|
+
def __new__(cls, quil: builtins.str, /, registers: typing.Sequence[builtins.str] = [], parameters: typing.Sequence[ExeParameter] = [], shots: typing.Optional[builtins.int] = None, quilc_client: typing.Optional[QuilcClient] = None, compiler_options: typing.Optional[CompilerOpts] = None) -> Executable: ...
|
|
106
|
+
def execute_on_qpu(self, quantum_processor_id: builtins.str, endpoint_id: typing.Optional[builtins.str] = None, translation_options: typing.Optional[TranslationOptions] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> ExecutionData:
|
|
107
|
+
r"""
|
|
108
|
+
Compile the program and execute it on a QPU, waiting for results.
|
|
109
|
+
|
|
110
|
+
:param `endpoint_id`: execute the compiled program against an explicitly provided endpoint.
|
|
111
|
+
If `None`, the default endpoint for the given `quantum_processor_id` is used.
|
|
112
|
+
|
|
113
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
114
|
+
"""
|
|
115
|
+
def execute_on_qpu_async(self, quantum_processor_id: builtins.str, endpoint_id: typing.Optional[builtins.str] = None, translation_options: typing.Optional[TranslationOptions] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[ExecutionData]:
|
|
116
|
+
r"""
|
|
117
|
+
Compile the program and execute it on a QPU, waiting for results
|
|
118
|
+
(async analog of `Executable.execute_on_qpu`).
|
|
119
|
+
|
|
120
|
+
:param `endpoint_id`: execute the compiled program against an explicitly provided endpoint.
|
|
121
|
+
If `None`, the default endpoint for the given `quantum_processor_id` is used.
|
|
122
|
+
|
|
123
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
124
|
+
"""
|
|
125
|
+
def execute_on_qvm(self, client: QVMClient) -> ExecutionData:
|
|
126
|
+
r"""
|
|
127
|
+
Execute on a QVM which is accessible via the provided client.
|
|
128
|
+
|
|
129
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
130
|
+
"""
|
|
131
|
+
def execute_on_qvm_async(self, client: QVMClient) -> collections.abc.Awaitable[ExecutionData]:
|
|
132
|
+
r"""
|
|
133
|
+
Execute on a QVM which is accessible via the provided client
|
|
134
|
+
(async analog of ``Executable.execute_on_qvm``).
|
|
135
|
+
|
|
136
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
137
|
+
"""
|
|
138
|
+
def retrieve_results(self, job_handle: JobHandle) -> ExecutionData:
|
|
139
|
+
r"""
|
|
140
|
+
Wait for the results of a job to complete.
|
|
141
|
+
|
|
142
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
143
|
+
"""
|
|
144
|
+
def retrieve_results_async(self, job_handle: JobHandle) -> collections.abc.Awaitable[ExecutionData]:
|
|
145
|
+
r"""
|
|
146
|
+
Wait for the results of a job to complete
|
|
147
|
+
(async analog of `Executable.retrieve_results`).
|
|
148
|
+
|
|
149
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
150
|
+
"""
|
|
151
|
+
def submit_to_qpu(self, quantum_processor_id: builtins.str, endpoint_id: typing.Optional[builtins.str] = None, translation_options: typing.Optional[TranslationOptions] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> JobHandle:
|
|
152
|
+
r"""
|
|
153
|
+
Compile the program and execute it on a QPU, without waiting for results.
|
|
154
|
+
|
|
155
|
+
:param `endpoint_id`: execute the compiled program against an explicitly provided endpoint.
|
|
156
|
+
If `None`, the default endpoint for the given `quantum_processor_id` is used.
|
|
157
|
+
|
|
158
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
159
|
+
"""
|
|
160
|
+
def submit_to_qpu_async(self, quantum_processor_id: builtins.str, endpoint_id: typing.Optional[builtins.str] = None, translation_options: typing.Optional[TranslationOptions] = None, execution_options: typing.Optional[ExecutionOptions] = None) -> collections.abc.Awaitable[JobHandle]:
|
|
161
|
+
r"""
|
|
162
|
+
Compile the program and execute it on a QPU, without waiting for results
|
|
163
|
+
(async analog of `Executable.submit_to_qpu`).
|
|
164
|
+
|
|
165
|
+
:param `endpoint_id`: execute the compiled program against an explicitly provided endpoint.
|
|
166
|
+
If `None`, the default endpoint for the given `quantum_processor_id` is used.
|
|
167
|
+
|
|
168
|
+
:raises `ExecutionError`: If the job fails to execute.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
@typing.final
|
|
172
|
+
class ExecutionData:
|
|
173
|
+
r"""
|
|
174
|
+
The result of executing an [`Executable`](crate::Executable)
|
|
175
|
+
"""
|
|
176
|
+
@property
|
|
177
|
+
def duration(self) -> typing.Optional[datetime.timedelta]:
|
|
178
|
+
r"""
|
|
179
|
+
The time it took to execute the program on the QPU, not including any network or queueing
|
|
180
|
+
time. If paying for on-demand execution, this is the amount you will be billed for.
|
|
181
|
+
|
|
182
|
+
This will always be `None` for QVM execution.
|
|
183
|
+
"""
|
|
184
|
+
@property
|
|
185
|
+
def result_data(self) -> QVMResultData | QPUResultData:
|
|
186
|
+
r"""
|
|
187
|
+
The [`ResultData`] that was read from the [`Executable`](crate::Executable).
|
|
188
|
+
"""
|
|
189
|
+
def __eq__(self, other: builtins.object) -> builtins.bool: ...
|
|
190
|
+
def __getnewargs__(self) -> tuple[QVMResultData | QPUResultData, typing.Optional[datetime.timedelta]]: ...
|
|
191
|
+
def __new__(cls, result_data: QVMResultData | QPUResultData, duration: typing.Optional[datetime.timedelta] = None) -> ExecutionData:
|
|
192
|
+
r"""
|
|
193
|
+
Create `ExecutionData` from `ResultData` and an optional `duration`.
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
class ExecutionError(QcsSdkError):
|
|
197
|
+
r"""
|
|
198
|
+
Errors which can occur when executing a program.
|
|
199
|
+
"""
|
|
200
|
+
...
|
|
201
|
+
|
|
202
|
+
@typing.final
|
|
203
|
+
class JobHandle:
|
|
204
|
+
r"""
|
|
205
|
+
The result of submitting a job to a QPU.
|
|
206
|
+
|
|
207
|
+
Used to retrieve the results of a job.
|
|
208
|
+
"""
|
|
209
|
+
@property
|
|
210
|
+
def job_id(self) -> builtins.str:
|
|
211
|
+
r"""
|
|
212
|
+
Unique ID associated with a single job execution.
|
|
213
|
+
"""
|
|
214
|
+
@property
|
|
215
|
+
def readout_map(self) -> builtins.dict[builtins.str, builtins.str]:
|
|
216
|
+
r"""
|
|
217
|
+
The readout map from "source readout memory locations"
|
|
218
|
+
to the "filter pipeline node" which publishes the data.
|
|
219
|
+
"""
|
|
220
|
+
|
|
221
|
+
class QcsSdkError(builtins.Exception):
|
|
222
|
+
r"""
|
|
223
|
+
Base exception type for errors raised by this package.
|
|
224
|
+
"""
|
|
225
|
+
...
|
|
226
|
+
|
|
227
|
+
class RegisterData:
|
|
228
|
+
r"""
|
|
229
|
+
Data resulting from [`Executable::execute_on_qvm`](`crate::Executable::execute_on_qvm`)
|
|
230
|
+
|
|
231
|
+
This represents a single vector (or "register") of typed memory across some number of shots.
|
|
232
|
+
The register corresponds to the usage of a `DECLARE` instruction in Quil, and the name of that
|
|
233
|
+
register should be provided with [`Executable::read_from`](`crate::Executable::read_from`).
|
|
234
|
+
|
|
235
|
+
There is a variant of this enum for each type of data that a register could hold. The register
|
|
236
|
+
is represented as a 2-dimensional array `M` where the value `M[shot_number][memory_index]`
|
|
237
|
+
represents the value at `memory_index` for `shot_number`.
|
|
238
|
+
|
|
239
|
+
# Usage
|
|
240
|
+
|
|
241
|
+
Typically, you will be interacting with this data through the [`crate::ResultData`] of an
|
|
242
|
+
[`crate::ExecutionData`] returned after running a program. In those cases, you'll probably
|
|
243
|
+
want to convert it to a readout map using [`crate::ResultData.to_register_map()`]. This
|
|
244
|
+
will give you each register in the form of a [`crate::RegisterMatrix`] which is similar
|
|
245
|
+
but backed by an [`ndarray::Array2`] and more convenient for working with matrices.
|
|
246
|
+
|
|
247
|
+
If you are interacting with [`RegisterData`] directly, then you should already know what type of data it _should_
|
|
248
|
+
have, so you can use the [`mod@enum_as_inner`] methods (e.g. [`RegisterData::into_i8`]) in order to
|
|
249
|
+
convert any variant type to its inner data.
|
|
250
|
+
"""
|
|
251
|
+
def __getnewargs__(self) -> tuple[builtins.list[builtins.list[builtins.int]] | builtins.list[builtins.list[builtins.float]] | builtins.list[builtins.list[builtins.complex]]]: ...
|
|
252
|
+
def __new__(cls, inner: typing.Sequence[typing.Sequence[builtins.int]] | typing.Sequence[typing.Sequence[builtins.float]] | typing.Sequence[typing.Sequence[builtins.complex]]) -> RegisterData: ...
|
|
253
|
+
def as_ndarray(self) -> numpy.ndarray:
|
|
254
|
+
r"""
|
|
255
|
+
Return the inner values as a 2D Numpy ``ndarray``.
|
|
256
|
+
"""
|
|
257
|
+
def inner(self) -> builtins.list[builtins.list[builtins.int]] | builtins.list[builtins.list[builtins.float]] | builtins.list[builtins.list[builtins.complex]]: ...
|
|
258
|
+
@typing.final
|
|
259
|
+
class Complex32(RegisterData):
|
|
260
|
+
r"""
|
|
261
|
+
Results containing complex numbers.
|
|
262
|
+
"""
|
|
263
|
+
__match_args__ = ("_0",)
|
|
264
|
+
@property
|
|
265
|
+
def _0(self) -> builtins.list[builtins.list[builtins.complex]]: ...
|
|
266
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
267
|
+
def __len__(self) -> builtins.int: ...
|
|
268
|
+
def __new__(cls, _0: typing.Sequence[typing.Sequence[builtins.complex]]) -> RegisterData.Complex32: ...
|
|
269
|
+
|
|
270
|
+
@typing.final
|
|
271
|
+
class F64(RegisterData):
|
|
272
|
+
r"""
|
|
273
|
+
Corresponds to the Quil `REAL` type.
|
|
274
|
+
"""
|
|
275
|
+
__match_args__ = ("_0",)
|
|
276
|
+
@property
|
|
277
|
+
def _0(self) -> builtins.list[builtins.list[builtins.float]]: ...
|
|
278
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
279
|
+
def __len__(self) -> builtins.int: ...
|
|
280
|
+
def __new__(cls, _0: typing.Sequence[typing.Sequence[builtins.float]]) -> RegisterData.F64: ...
|
|
281
|
+
|
|
282
|
+
@typing.final
|
|
283
|
+
class I16(RegisterData):
|
|
284
|
+
r"""
|
|
285
|
+
Corresponds to the Quil `INTEGER` type.
|
|
286
|
+
"""
|
|
287
|
+
__match_args__ = ("_0",)
|
|
288
|
+
@property
|
|
289
|
+
def _0(self) -> builtins.list[builtins.list[builtins.int]]: ...
|
|
290
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
291
|
+
def __len__(self) -> builtins.int: ...
|
|
292
|
+
def __new__(cls, _0: typing.Sequence[typing.Sequence[builtins.int]]) -> RegisterData.I16: ...
|
|
293
|
+
|
|
294
|
+
@typing.final
|
|
295
|
+
class I8(RegisterData):
|
|
296
|
+
r"""
|
|
297
|
+
Corresponds to the Quil `BIT` or `OCTET` types.
|
|
298
|
+
"""
|
|
299
|
+
__match_args__ = ("_0",)
|
|
300
|
+
@property
|
|
301
|
+
def _0(self) -> builtins.list[builtins.list[builtins.int]]: ...
|
|
302
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
303
|
+
def __len__(self) -> builtins.int: ...
|
|
304
|
+
def __new__(cls, _0: typing.Sequence[typing.Sequence[builtins.int]]) -> RegisterData.I8: ...
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
@typing.final
|
|
308
|
+
class RegisterMap:
|
|
309
|
+
r"""
|
|
310
|
+
A mapping of a register name (ie. "ro") to a [`RegisterMatrix`] containing the values for the
|
|
311
|
+
register.
|
|
312
|
+
"""
|
|
313
|
+
def __contains__(self, key: builtins.str) -> builtins.bool: ...
|
|
314
|
+
def __getitem__(self, item: builtins.str) -> RegisterMatrix: ...
|
|
315
|
+
def __iter__(self) -> RegisterMapKeysIter: ...
|
|
316
|
+
def __len__(self) -> builtins.int: ...
|
|
317
|
+
def get(self, key: builtins.str, default: typing.Optional[RegisterMatrix] = None) -> typing.Optional[RegisterMatrix]: ...
|
|
318
|
+
def get_register_matrix(self, register_name: builtins.str) -> typing.Optional[RegisterMatrix]:
|
|
319
|
+
r"""
|
|
320
|
+
Get the `RegisterMatrix` for the given register.
|
|
321
|
+
|
|
322
|
+
Returns `None` if the register doesn't exist.
|
|
323
|
+
"""
|
|
324
|
+
def items(self) -> RegisterMapItemsIter: ...
|
|
325
|
+
def keys(self) -> RegisterMapKeysIter: ...
|
|
326
|
+
def values(self) -> RegisterMapValuesIter: ...
|
|
327
|
+
|
|
328
|
+
@typing.final
|
|
329
|
+
class RegisterMapItemsIter:
|
|
330
|
+
def __iter__(self) -> RegisterMapItemsIter: ...
|
|
331
|
+
def __next__(self) -> tuple[builtins.str, RegisterMatrix]: ...
|
|
332
|
+
|
|
333
|
+
@typing.final
|
|
334
|
+
class RegisterMapKeysIter:
|
|
335
|
+
def __iter__(self) -> RegisterMapKeysIter: ...
|
|
336
|
+
def __next__(self) -> builtins.str: ...
|
|
337
|
+
|
|
338
|
+
@typing.final
|
|
339
|
+
class RegisterMapValuesIter:
|
|
340
|
+
def __iter__(self) -> RegisterMapValuesIter: ...
|
|
341
|
+
def __next__(self) -> RegisterMatrix: ...
|
|
342
|
+
|
|
343
|
+
class RegisterMatrix:
|
|
344
|
+
r"""
|
|
345
|
+
A 2-dimensional matrix of register values.
|
|
346
|
+
|
|
347
|
+
Each variant corresponds to the possible data types a register can contain.
|
|
348
|
+
"""
|
|
349
|
+
def to_ndarray(self) -> typing.Any:
|
|
350
|
+
r"""
|
|
351
|
+
Get the `RegisterMatrix` as Numpy ``ndarray``.
|
|
352
|
+
"""
|
|
353
|
+
@typing.final
|
|
354
|
+
class Complex(RegisterMatrix):
|
|
355
|
+
r"""
|
|
356
|
+
Complex numbered register.
|
|
357
|
+
"""
|
|
358
|
+
__match_args__ = ("_0",)
|
|
359
|
+
@property
|
|
360
|
+
def _0(self) -> numpy.typing.NDArray[numpy.complex128]: ...
|
|
361
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
362
|
+
def __len__(self) -> builtins.int: ...
|
|
363
|
+
def __new__(cls, _0: numpy.typing.NDArray[numpy.complex128]) -> RegisterMatrix.Complex: ...
|
|
364
|
+
|
|
365
|
+
@typing.final
|
|
366
|
+
class Integer(RegisterMatrix):
|
|
367
|
+
r"""
|
|
368
|
+
Integer register.
|
|
369
|
+
"""
|
|
370
|
+
__match_args__ = ("_0",)
|
|
371
|
+
@property
|
|
372
|
+
def _0(self) -> numpy.typing.NDArray[numpy.int64]: ...
|
|
373
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
374
|
+
def __len__(self) -> builtins.int: ...
|
|
375
|
+
def __new__(cls, _0: numpy.typing.NDArray[numpy.int64]) -> RegisterMatrix.Integer: ...
|
|
376
|
+
|
|
377
|
+
@typing.final
|
|
378
|
+
class Real(RegisterMatrix):
|
|
379
|
+
r"""
|
|
380
|
+
Real numbered register.
|
|
381
|
+
"""
|
|
382
|
+
__match_args__ = ("_0",)
|
|
383
|
+
@property
|
|
384
|
+
def _0(self) -> numpy.typing.NDArray[numpy.float64]: ...
|
|
385
|
+
def __getitem__(self, key: builtins.int) -> typing.Any: ...
|
|
386
|
+
def __len__(self) -> builtins.int: ...
|
|
387
|
+
def __new__(cls, _0: numpy.typing.NDArray[numpy.float64]) -> RegisterMatrix.Real: ...
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
class RegisterMatrixConversionError(QcsSdkError):
|
|
391
|
+
r"""
|
|
392
|
+
Error that may occur when building a `RegisterMatrix` from execution data.
|
|
393
|
+
"""
|
|
394
|
+
...
|
|
395
|
+
|
|
396
|
+
@typing.final
|
|
397
|
+
class Service(enum.Enum):
|
|
398
|
+
r"""
|
|
399
|
+
The external services that this SDK may connect to. Used to differentiate between networking
|
|
400
|
+
issues in [`Error::Connection`].
|
|
401
|
+
"""
|
|
402
|
+
QUILC = ...
|
|
403
|
+
r"""
|
|
404
|
+
The open source [`quilc`](https://github.com/quil-lang/quilc) compiler.
|
|
405
|
+
|
|
406
|
+
This compiler must be running before calling [`Executable::execute_on_qpu`] unless the
|
|
407
|
+
[`Executable::compile_with_quilc`] option is set to `false`. By default, it's assumed that
|
|
408
|
+
this is running on `tcp://localhost:5555`, but this can be overridden via
|
|
409
|
+
`[profiles.<profile_name>.applications.pyquil.quilc_url]` in your `.qcs/settings.toml` file.
|
|
410
|
+
"""
|
|
411
|
+
QVM = ...
|
|
412
|
+
r"""
|
|
413
|
+
The open source [`qvm`](https://github.com/quil-lang/qvm) simulator.
|
|
414
|
+
|
|
415
|
+
This simulator must be running before calling [`Executable::execute_on_qvm`]. By default,
|
|
416
|
+
it's assumed that this is running on `http://localhost:5000`, but this can be overridden via
|
|
417
|
+
`[profiles.<profile_name>.applications.pyquil.qvm_url]` in your `.qcs/settings.toml` file.
|
|
418
|
+
"""
|
|
419
|
+
QCS = ...
|
|
420
|
+
r"""
|
|
421
|
+
The connection to [`QCS`](https://docs.rigetti.com/qcs/), the API for authentication,
|
|
422
|
+
QPU lookup, and translation.
|
|
423
|
+
|
|
424
|
+
You should be able to reach this service as long as you have a connection to the internet.
|
|
425
|
+
"""
|
|
426
|
+
QPU = ...
|
|
427
|
+
r"""
|
|
428
|
+
The connection to the QPU itself. You can only connect to the QPU from an authorized network
|
|
429
|
+
(like QCS JupyterLab).
|
|
430
|
+
"""
|
|
431
|
+
|
|
432
|
+
def _gather_diagnostics() -> builtins.str: ...
|
|
433
|
+
|
|
434
|
+
def reset_logging() -> None:
|
|
435
|
+
r"""
|
|
436
|
+
Reset all caches for logging configuration within this library,
|
|
437
|
+
allowing the most recent Python-side changes to be applied.
|
|
438
|
+
|
|
439
|
+
See <https://docs.rs/pyo3-log/latest/pyo3_log/> for more information.
|
|
440
|
+
"""
|
|
441
|
+
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# The following are all type aliases.
|
|
2
|
+
qcs_sdk._tracing_subscriber.ExportConfig
|
|
3
|
+
qcs_sdk._tracing_subscriber.TracingConfig
|
|
4
|
+
qcs_sdk._tracing_subscriber.layers.Config
|
|
5
|
+
qcs_sdk._tracing_subscriber.layers.otel_otlp.ResourceValue
|
|
6
|
+
qcs_sdk._tracing_subscriber.layers.otel_otlp.ResourceValueArray
|
|
7
|
+
qcs_sdk._tracing_subscriber.layers.otel_otlp.Sampler
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# * AUTO-GENERATED CODE *
|
|
3
|
+
# * *
|
|
4
|
+
# * This code was generated by the `pyo3-tracing-subscriber` crate. Any *
|
|
5
|
+
# * modifications to this file should be made to the script or the generation *
|
|
6
|
+
# * process that produced this code. Specifically, see: *
|
|
7
|
+
# * `pyo3_tracing_subscriber::stubs::write_stub_files` *
|
|
8
|
+
# * *
|
|
9
|
+
# * Do not manually edit this file, as your changes may be overwritten the *
|
|
10
|
+
# * next time the code is generated. *
|
|
11
|
+
# *****************************************************************************
|
|
12
|
+
|
|
13
|
+
from qcs_sdk import _tracing_subscriber
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__doc__ = _tracing_subscriber.__doc__
|
|
17
|
+
__all__ = getattr(_tracing_subscriber, "__all__", [])
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# * AUTO-GENERATED CODE *
|
|
3
|
+
# * *
|
|
4
|
+
# * This code was generated by the `pyo3-tracing-subscriber` crate. Any *
|
|
5
|
+
# * modifications to this file should be made to the script or the generation *
|
|
6
|
+
# * process that produced this code. Specifically, see: *
|
|
7
|
+
# * `pyo3_tracing_subscriber::stubs::write_stub_files` *
|
|
8
|
+
# * *
|
|
9
|
+
# * Do not manually edit this file, as your changes may be overwritten the *
|
|
10
|
+
# * next time the code is generated. *
|
|
11
|
+
# *****************************************************************************
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from types import TracebackType
|
|
16
|
+
from typing import TYPE_CHECKING, Optional, Type, final
|
|
17
|
+
|
|
18
|
+
from . import common as common
|
|
19
|
+
from . import layers as layers
|
|
20
|
+
from . import subscriber as subscriber
|
|
21
|
+
|
|
22
|
+
class TracingContextManagerError(RuntimeError):
|
|
23
|
+
"""
|
|
24
|
+
Raised if the initialization, enter, and exit of the tracing context manager was
|
|
25
|
+
invoked in an invalid order.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
class TracingStartError(RuntimeError):
|
|
31
|
+
"""
|
|
32
|
+
Raised if the tracing subscriber configuration is invalid or if a background export task
|
|
33
|
+
fails to start.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
...
|
|
37
|
+
|
|
38
|
+
class TracingShutdownError(RuntimeError):
|
|
39
|
+
"""
|
|
40
|
+
Raised if the tracing subscriber fails to shutdown cleanly.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
@final
|
|
46
|
+
class BatchConfig:
|
|
47
|
+
"""
|
|
48
|
+
Configuration for exporting spans in batch. This will require a background task to be spawned
|
|
49
|
+
and run for the duration of the tracing context manager.
|
|
50
|
+
|
|
51
|
+
This configuration is typically favorable unless the tracing context manager is short lived.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
def __new__(cls, subscriber: subscriber.Config | None = None) -> "BatchConfig": ...
|
|
55
|
+
|
|
56
|
+
@final
|
|
57
|
+
class SimpleConfig:
|
|
58
|
+
"""
|
|
59
|
+
Configuration for exporting spans in a simple manner. This does not spawn a background task
|
|
60
|
+
unless it is required by the configured export layer. Generally favor `BatchConfig` instead,
|
|
61
|
+
unless the tracing context manager is short lived.
|
|
62
|
+
|
|
63
|
+
Note, some export layers still spawn a background task even when `SimpleConfig` is used.
|
|
64
|
+
This is the case for the OTLP export layer, which makes gRPC export requests within the
|
|
65
|
+
background Tokio runtime.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def __new__(cls, subscriber: subscriber.Config | None = None) -> "SimpleConfig": ...
|
|
69
|
+
|
|
70
|
+
@final
|
|
71
|
+
class CurrentThreadTracingConfig:
|
|
72
|
+
"""
|
|
73
|
+
This tracing configuration will export spans emitted only on the current thread. A `Tracing` context
|
|
74
|
+
manager may be initialized multiple times for the same process with this configuration (although
|
|
75
|
+
they should not be nested).
|
|
76
|
+
|
|
77
|
+
Note, this configuration is currently incompatible with async methods defined with `pyo3_asyncio`.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def __new__(cls, export_process: "ExportConfig" | None = None) -> "CurrentThreadTracingConfig": ...
|
|
81
|
+
|
|
82
|
+
@final
|
|
83
|
+
class GlobalTracingConfig:
|
|
84
|
+
"""
|
|
85
|
+
This tracing configuration will export spans emitted on any thread in the current process. Because
|
|
86
|
+
it sets a tracing subscriber at the global level, it can only be initialized once per process.
|
|
87
|
+
|
|
88
|
+
This is typically favorable, as it only requires a single initialization across your entire Python
|
|
89
|
+
application.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
def __new__(cls, export_process: "ExportConfig" | None = None) -> "GlobalTracingConfig": ...
|
|
93
|
+
|
|
94
|
+
@final
|
|
95
|
+
class Tracing:
|
|
96
|
+
"""
|
|
97
|
+
A context manager that initializes a tracing subscriber and exports spans
|
|
98
|
+
emitted from within the parent Rust-Python package. It may be used synchonously
|
|
99
|
+
or asynchronously.
|
|
100
|
+
|
|
101
|
+
Each instance of this context manager can only be used once and only once.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
def __new__(cls, config: "TracingConfig" | None = None) -> "Tracing": ...
|
|
105
|
+
def __enter__(self): ...
|
|
106
|
+
def __exit__(
|
|
107
|
+
self,
|
|
108
|
+
exc_type: Optional[Type[BaseException]],
|
|
109
|
+
exc_value: Optional[BaseException],
|
|
110
|
+
traceback: Optional[TracebackType],
|
|
111
|
+
): ...
|
|
112
|
+
async def __aenter__(self): ...
|
|
113
|
+
async def __aexit__(
|
|
114
|
+
self,
|
|
115
|
+
exc_type: Optional[Type[BaseException]],
|
|
116
|
+
exc_value: Optional[BaseException],
|
|
117
|
+
traceback: Optional[TracebackType],
|
|
118
|
+
): ...
|
|
119
|
+
|
|
120
|
+
if TYPE_CHECKING:
|
|
121
|
+
from typing import Union
|
|
122
|
+
|
|
123
|
+
ExportConfig = Union[BatchConfig, SimpleConfig]
|
|
124
|
+
"""
|
|
125
|
+
One of `BatchConfig` or `SimpleConfig`.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
TracingConfig = Union[CurrentThreadTracingConfig, GlobalTracingConfig]
|
|
129
|
+
"""
|
|
130
|
+
One of `CurrentThreadTracingConfig` or `GlobalTracingConfig`.
|
|
131
|
+
"""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# *****************************************************************************
|
|
2
|
+
# * AUTO-GENERATED CODE *
|
|
3
|
+
# * *
|
|
4
|
+
# * This code was generated by the `pyo3-tracing-subscriber` crate. Any *
|
|
5
|
+
# * modifications to this file should be made to the script or the generation *
|
|
6
|
+
# * process that produced this code. Specifically, see: *
|
|
7
|
+
# * `pyo3_tracing_subscriber::stubs::write_stub_files` *
|
|
8
|
+
# * *
|
|
9
|
+
# * Do not manually edit this file, as your changes may be overwritten the *
|
|
10
|
+
# * next time the code is generated. *
|
|
11
|
+
# *****************************************************************************
|
|
12
|
+
|
|
13
|
+
from qcs_sdk._tracing_subscriber import common
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__doc__ = common.__doc__
|
|
17
|
+
__all__ = getattr(common, "__all__", [])
|
|
18
|
+
|