qcs 0.26.1

High level interface for running Quil on a QPU
Documentation
# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501, F401

import builtins
import collections.abc
import enum
import typing
from qcs_sdk import QcsSdkError
from qcs_sdk.client import QCSClient

@typing.final
class QCtrl:
    r"""
    Options for compiling programs through the Q-CTRL API.
    
    Options here are specially authorized and are not generally available to the client.
    """
    def __new__(cls, fixed_layout: typing.Optional[builtins.bool] = None) -> QCtrl: ...

@typing.final
class Riverlane:
    r"""
    Options for configuring Riverlane features prior to execution.
    
    Options here are specially authorized and are not generally available to the client.
    """
    def __new__(cls, qeci_configuration_data: typing.Mapping[builtins.str, typing.Sequence[builtins.int]], qeci_max_nanoseconds_until_read_available: builtins.int) -> Riverlane: ...

class TranslationError(QcsSdkError):
    r"""
    Errors raised due to failure to translate a program.
    """
    ...

@typing.final
class TranslationOptions:
    r"""
    Options available for Quil program translation.
    
    This wraps [`ApiTranslationOptions`] in order to improve the user experience,
    because the structs auto-generated by `prost` can be clumsy to use directly.
    """
    @property
    def backend(self) -> typing.Optional[TranslationBackend]:
        r"""
        Get the backend used for translation
        """
    def __new__(cls) -> TranslationOptions: ...
    def __repr__(self) -> builtins.str:
        r"""
        Implements `__repr__` for Python in terms of the Rust
        [`Debug`](std::fmt::Debug) implementation.
        """
    def encode_as_protobuf(self) -> bytes:
        r"""
        Serialize these translation options into the Protocol Buffer format.
        """
    def use_backend_v1(self) -> None:
        r"""
        Use the first-generation translation backend available on QCS since 2018.
        """
    def use_backend_v2(self) -> None:
        r"""
        Use the second-generation translation backend available on QCS since 2023.
        """
    def use_q_ctrl(self, q_ctrl: typing.Optional[QCtrl] = None) -> None:
        r"""
        Compile the program through Q-CTRL's API prior to translation.
        
        The client should generally leave the `q_ctrl` compile options unset
        as it is specially authorized and not generally available.
        """
    def use_riverlane(self, riverlane: Riverlane = ...) -> None:
        r"""
        Configure Riverlane features prior to execution.
        
        Options here are specially authorized and are not generally available to the client.
        """
    @staticmethod
    def v1() -> TranslationOptions:
        r"""
        Use the v1 backend for translation, available on QCS since 2018.
        """
    @staticmethod
    def v2(*, prepend_default_calibrations: typing.Optional[builtins.bool] = None, passive_reset_delay_seconds: typing.Optional[builtins.float] = None, allow_unchecked_pointer_arithmetic: typing.Optional[builtins.bool] = None, allow_frame_redefinition: typing.Optional[builtins.bool] = None) -> TranslationOptions:
        r"""
        Use the v2 backend for translation, available on QCS since 2023.
        
        :param `prepend_default_calibrations`: If False, do not prepend the default calibrations to the translated program.
        :param `passive_reset_delay_seconds`: The delay between passive resets, in seconds.
        :param `allow_unchecked_pointer_arithmetic`: If True, disable runtime memory bounds checking. Only available to certain users.
        :param `allow_frame_redefinition`: If True, allow defined frames to differ from Rigetti defaults. Only available to certain users. Otherwise, only ``INITIAL-FREQUENCY`` and ``CHANNEL-DELAY`` may be modified.
        """

@typing.final
class TranslationResult:
    r"""
    The result of a call to [`translate`] which provides information about the translated program.
    """
    @property
    def program(self) -> builtins.str:
        r"""
        The translated program.
        """
    @property
    def ro_sources(self) -> typing.Optional[builtins.dict[builtins.str, builtins.str]]:
        r"""
        A mapping from the program's memory references to the key used to index the results map.
        """

@typing.final
class TranslationBackend(enum.Enum):
    r"""
    The backend used for translation.
    """
    V1 = ...
    r"""
    The first-generation translation backend available on QCS since 2018.
    """
    V2 = ...
    r"""
    The second-generation translation backend available on QCS since 2023.
    """

def get_quilt_calibrations(quantum_processor_id: builtins.str, client: typing.Optional[QCSClient] = None, timeout: typing.Optional[builtins.float] = None) -> builtins.str:
    r"""
    Retrieve the calibration data used for client-side Quil-T generation.
    
    :param `quantum_processor_id`: The ID of the quantum processor.
    :param `client`: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
    :param `timeout`: Maximum duration to wait for API calls to complete, in seconds. Defaults to 10 seconds.
    
    :returns: The Quil calibration program for the requested quantum processor.
    
    :raises `LoadClientError`: If there is an issue loading the QCS Client configuration.
    :raises `TranslationError`: If there was a problem fetching Quil-T calibrations.
    """

def get_quilt_calibrations_async(quantum_processor_id: builtins.str, client: typing.Optional[QCSClient] = None, timeout: typing.Optional[builtins.float] = None) -> collections.abc.Awaitable[builtins.str]:
    r"""
    Retrieve the calibration data used for client-side Quil-T generation.
    
    :param `quantum_processor_id`: The ID of the quantum processor.
    :param `client`: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
    :param `timeout`: Maximum duration to wait for API calls to complete, in seconds. Defaults to 10 seconds.
    
    :returns: The Quil calibration program for the requested quantum processor.
    
    :raises `LoadClientError`: If there is an issue loading the QCS Client configuration.
    :raises `TranslationError`: If there was a problem fetching Quil-T calibrations.
    """

def translate(native_quil: builtins.str, num_shots: builtins.int, quantum_processor_id: builtins.str, client: typing.Optional[QCSClient] = None, translation_options: typing.Optional[TranslationOptions] = None) -> TranslationResult:
    r"""
    Translates a native Quil program into an executable program.
    
    :param `native_quil`: A Quil program.
    :param `num_shots`: The number of shots to perform.
    :param `quantum_processor_id`: The ID of the quantum processor the executable will run on (e.g. "Aspen-M-2").
    :param `client`: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
    :param `translation_options`: Optional translation options.
    
    :raises `LoadClientError`: If there is an issue loading the QCS Client configuration.
    :raises `TranslationError`: If the `native_quil` program could not be translated.
    """

def translate_async(native_quil: builtins.str, num_shots: builtins.int, quantum_processor_id: builtins.str, client: typing.Optional[QCSClient] = None, translation_options: typing.Optional[TranslationOptions] = None) -> collections.abc.Awaitable[TranslationResult]:
    r"""
    Translates a native Quil program into an executable program.
    
    :param `native_quil`: A Quil program.
    :param `num_shots`: The number of shots to perform.
    :param `quantum_processor_id`: The ID of the quantum processor the executable will run on (e.g. "Aspen-M-2").
    :param `client`: The ``Qcs`` client to use. Creates one using environment configuration if unset - see https://docs.rigetti.com/qcs/references/qcs-client-configuration
    :param `translation_options`: Optional translation options.
    
    :raises `LoadClientError`: If there is an issue loading the QCS Client configuration.
    :raises `TranslationError`: If the `native_quil` program could not be translated.
    """