diff --git a/docs/sdk/async/devbox.rst b/docs/sdk/async/devbox.rst index ef04443d7..35bc9ed58 100644 --- a/docs/sdk/async/devbox.rst +++ b/docs/sdk/async/devbox.rst @@ -6,3 +6,6 @@ The ``AsyncDevbox`` class provides asynchronous methods for managing and interac .. automodule:: runloop_api_client.sdk.async_devbox :members: +.. automodule:: runloop_api_client.sdk.protocols + :members: AsyncCommandInterface, AsyncFileInterface, AsyncNetworkInterface + :undoc-members: \ No newline at end of file diff --git a/docs/sdk/sync/devbox.rst b/docs/sdk/sync/devbox.rst index ca60c6993..924f96062 100644 --- a/docs/sdk/sync/devbox.rst +++ b/docs/sdk/sync/devbox.rst @@ -6,3 +6,6 @@ The ``Devbox`` class provides synchronous methods for managing and interacting w .. automodule:: runloop_api_client.sdk.devbox :members: +.. automodule:: runloop_api_client.sdk.protocols + :members: CommandInterface, FileInterface, NetworkInterface + :undoc-members: \ No newline at end of file diff --git a/docs/sdk/types.rst b/docs/sdk/types.rst index ba46d7ef2..dabe6680d 100644 --- a/docs/sdk/types.rst +++ b/docs/sdk/types.rst @@ -1,27 +1,21 @@ Type Reference ============== -This page documents all TypeDict parameter types used throughout the SDK. +The Runloop Python SDK uses TypeDict objects for configuration parameters to the various API calls. This page documents the TypeDict objects used throughout the SDK. -Core Request Options +Blueprint Parameters -------------------- -These TypeDicts define options for streaming, timeouts, polling, and other request configuration. - -.. autotypeddict:: runloop_api_client.sdk._types.ExecuteStreamingCallbacks - -.. autotypeddict:: runloop_api_client.sdk._types.RequestOptions - -.. autotypeddict:: runloop_api_client.sdk._types.LongRequestOptions +These TypeDicts define parameters for blueprint creation and listing. -.. autotypeddict:: runloop_api_client.sdk._types.PollingRequestOptions +.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintCreateParams -.. autotypeddict:: runloop_api_client.sdk._types.LongPollingRequestOptions +.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintListParams Devbox Parameters ----------------- -These TypeDicts define parameters for devbox creation, execution, file operations, network tunnels, and snapshots. +These TypeDicts define parameters for devbox creation, listing, and operations. Creation Parameters ~~~~~~~~~~~~~~~~~~~ @@ -30,18 +24,18 @@ Creation Parameters .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxCreateFromImageParams -Execution Parameters -~~~~~~~~~~~~~~~~~~~~ - -.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteParams - -.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteAsyncParams - Listing Parameters ~~~~~~~~~~~~~~~~~~ .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxListParams +Command Execution Parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteParams + +.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteAsyncParams + File Operation Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -54,14 +48,16 @@ File Operation Parameters .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxUploadFileParams Network Tunnel Parameters -~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~ .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxCreateTunnelParams .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxRemoveTunnelParams Snapshot Parameters -~~~~~~~~~~~~~~~~~~~ +------------------- + +These TypeDicts define parameters for snapshot creation, listing, and updating. .. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxSnapshotDiskParams @@ -71,15 +67,6 @@ Snapshot Parameters .. autotypeddict:: runloop_api_client.sdk._types.SDKDiskSnapshotUpdateParams -Blueprint Parameters --------------------- - -These TypeDicts define parameters for blueprint creation and listing. - -.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintCreateParams - -.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintListParams - Storage Object Parameters ------------------------- @@ -90,3 +77,33 @@ These TypeDicts define parameters for storage object creation, listing, and down .. autotypeddict:: runloop_api_client.sdk._types.SDKObjectListParams .. autotypeddict:: runloop_api_client.sdk._types.SDKObjectDownloadParams + +Core Request Options +-------------------- + +These TypeDicts define options for timeouts, idempotency, polling, and other low-level request configuration. All other TypeDicts in the SDK extend from one of these core types. + +.. autotypeddict:: runloop_api_client.sdk._types.BaseRequestOptions + +.. autotypeddict:: runloop_api_client.sdk._types.LongRequestOptions + +.. autoclass:: runloop_api_client.sdk._types.PollingConfig + :members: + :undoc-members: + +.. autotypeddict:: runloop_api_client.sdk._types.PollingRequestOptions + +.. autotypeddict:: runloop_api_client.sdk._types.LongPollingRequestOptions + +Base API Type Reference +----------------------- + +.. automodule:: runloop_api_client.types.shared_params + :members: + :undoc-members: + :imported-members: + +.. automodule:: runloop_api_client.types + :members: + :undoc-members: + :imported-members: \ No newline at end of file diff --git a/src/runloop_api_client/sdk/_types.py b/src/runloop_api_client/sdk/_types.py index 7ac404055..1a566e7f5 100644 --- a/src/runloop_api_client/sdk/_types.py +++ b/src/runloop_api_client/sdk/_types.py @@ -36,7 +36,7 @@ class ExecuteStreamingCallbacks(TypedDict, total=False): """Callback invoked for all log lines (both stdout and stderr)""" -class RequestOptions(TypedDict, total=False): +class BaseRequestOptions(TypedDict, total=False): extra_headers: Optional[Headers] """Send extra headers""" @@ -50,12 +50,12 @@ class RequestOptions(TypedDict, total=False): """Override the client-level default timeout for this request, in seconds""" -class LongRequestOptions(RequestOptions, total=False): +class LongRequestOptions(BaseRequestOptions, total=False): idempotency_key: Optional[str] """Specify a custom idempotency key for this request""" -class PollingRequestOptions(RequestOptions, total=False): +class PollingRequestOptions(BaseRequestOptions, total=False): polling_config: Optional[PollingConfig] """Configuration for polling behavior""" @@ -80,7 +80,7 @@ class SDKDevboxExecuteAsyncParams(DevboxExecuteAsyncParams, ExecuteStreamingCall pass -class SDKDevboxListParams(DevboxListParams, RequestOptions): +class SDKDevboxListParams(DevboxListParams, BaseRequestOptions): pass @@ -116,7 +116,7 @@ class SDKDevboxSnapshotDiskParams(DevboxSnapshotDiskParams, LongPollingRequestOp pass -class SDKDiskSnapshotListParams(DiskSnapshotListParams, RequestOptions): +class SDKDiskSnapshotListParams(DiskSnapshotListParams, BaseRequestOptions): pass @@ -128,11 +128,11 @@ class SDKBlueprintCreateParams(BlueprintCreateParams, LongPollingRequestOptions) pass -class SDKBlueprintListParams(BlueprintListParams, RequestOptions): +class SDKBlueprintListParams(BlueprintListParams, BaseRequestOptions): pass -class SDKObjectListParams(ObjectListParams, RequestOptions): +class SDKObjectListParams(ObjectListParams, BaseRequestOptions): pass @@ -140,5 +140,5 @@ class SDKObjectCreateParams(ObjectCreateParams, LongRequestOptions): pass -class SDKObjectDownloadParams(ObjectDownloadParams, RequestOptions): +class SDKObjectDownloadParams(ObjectDownloadParams, BaseRequestOptions): pass diff --git a/src/runloop_api_client/sdk/async_blueprint.py b/src/runloop_api_client/sdk/async_blueprint.py index ab070cb89..4e805b6e3 100644 --- a/src/runloop_api_client/sdk/async_blueprint.py +++ b/src/runloop_api_client/sdk/async_blueprint.py @@ -5,7 +5,7 @@ from typing_extensions import Unpack, override from ..types import BlueprintView -from ._types import RequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams +from ._types import BaseRequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams from .._client import AsyncRunloop from .async_devbox import AsyncDevbox from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView @@ -44,7 +44,7 @@ def id(self) -> str: async def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> BlueprintView: """Retrieve the latest blueprint details. @@ -59,7 +59,7 @@ async def get_info( async def logs( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> BlueprintBuildLogsListView: """Retrieve build logs for the blueprint. diff --git a/src/runloop_api_client/sdk/async_devbox.py b/src/runloop_api_client/sdk/async_devbox.py index cf553b021..c1794ccf5 100644 --- a/src/runloop_api_client/sdk/async_devbox.py +++ b/src/runloop_api_client/sdk/async_devbox.py @@ -15,7 +15,7 @@ ) from ._types import ( LogCallback, - RequestOptions, + BaseRequestOptions, LongRequestOptions, PollingRequestOptions, SDKDevboxExecuteParams, @@ -104,7 +104,7 @@ def id(self) -> str: async def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> DevboxView: """Retrieve current devbox status and metadata. diff --git a/src/runloop_api_client/sdk/async_execution.py b/src/runloop_api_client/sdk/async_execution.py index cef1b29d9..242a869bd 100644 --- a/src/runloop_api_client/sdk/async_execution.py +++ b/src/runloop_api_client/sdk/async_execution.py @@ -7,7 +7,7 @@ from typing import Optional, Awaitable, cast from typing_extensions import Unpack, override -from ._types import RequestOptions, LongRequestOptions +from ._types import BaseRequestOptions, LongRequestOptions from .._client import AsyncRunloop from .async_execution_result import AsyncExecutionResult from ..types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView @@ -119,7 +119,7 @@ async def result(self, **options: Unpack[LongRequestOptions]) -> AsyncExecutionR final = cast(DevboxAsyncExecutionDetailView, command_result) return AsyncExecutionResult(self._client, self._devbox_id, final) - async def get_state(self, **options: Unpack[RequestOptions]) -> DevboxAsyncExecutionDetailView: + async def get_state(self, **options: Unpack[BaseRequestOptions]) -> DevboxAsyncExecutionDetailView: """Fetch the latest execution state. :param options: Optional request configuration diff --git a/src/runloop_api_client/sdk/async_snapshot.py b/src/runloop_api_client/sdk/async_snapshot.py index f08ee31bc..d5faba70f 100644 --- a/src/runloop_api_client/sdk/async_snapshot.py +++ b/src/runloop_api_client/sdk/async_snapshot.py @@ -5,7 +5,7 @@ from typing_extensions import Unpack, override from ._types import ( - RequestOptions, + BaseRequestOptions, LongRequestOptions, PollingRequestOptions, SDKDiskSnapshotUpdateParams, @@ -50,7 +50,7 @@ def id(self) -> str: async def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> DevboxSnapshotAsyncStatusView: """Retrieve the latest snapshot status. diff --git a/src/runloop_api_client/sdk/async_storage_object.py b/src/runloop_api_client/sdk/async_storage_object.py index 52e548ad0..5a3e9cb9e 100644 --- a/src/runloop_api_client/sdk/async_storage_object.py +++ b/src/runloop_api_client/sdk/async_storage_object.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Unpack, override -from ._types import RequestOptions, LongRequestOptions, SDKObjectDownloadParams +from ._types import BaseRequestOptions, LongRequestOptions, SDKObjectDownloadParams from .._client import AsyncRunloop from ..types.object_view import ObjectView from ..types.object_download_url_view import ObjectDownloadURLView @@ -52,7 +52,7 @@ def upload_url(self) -> str | None: async def refresh( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> ObjectView: """Fetch the latest metadata for the object. diff --git a/src/runloop_api_client/sdk/blueprint.py b/src/runloop_api_client/sdk/blueprint.py index bc06b0601..8e9daac3e 100644 --- a/src/runloop_api_client/sdk/blueprint.py +++ b/src/runloop_api_client/sdk/blueprint.py @@ -5,7 +5,7 @@ from typing_extensions import Unpack, override from ..types import BlueprintView -from ._types import RequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams +from ._types import BaseRequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams from .devbox import Devbox from .._client import Runloop from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView @@ -44,7 +44,7 @@ def id(self) -> str: def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> BlueprintView: """Retrieve the latest blueprint details. @@ -59,7 +59,7 @@ def get_info( def logs( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> BlueprintBuildLogsListView: """Retrieve build logs for the blueprint. diff --git a/src/runloop_api_client/sdk/devbox.py b/src/runloop_api_client/sdk/devbox.py index 7f1f2fa63..3643afc78 100644 --- a/src/runloop_api_client/sdk/devbox.py +++ b/src/runloop_api_client/sdk/devbox.py @@ -15,7 +15,7 @@ ) from ._types import ( LogCallback, - RequestOptions, + BaseRequestOptions, LongRequestOptions, PollingRequestOptions, SDKDevboxExecuteParams, @@ -103,13 +103,13 @@ def id(self) -> str: def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> DevboxView: """Retrieve current devbox status and metadata. :param options: Optional request configuration :return: Current devbox state info - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ return self._client.devboxes.retrieve( self._id, @@ -124,7 +124,7 @@ def await_running(self, *, polling_config: PollingConfig | None = None) -> Devbo :param polling_config: Optional configuration for polling behavior (timeout, interval), defaults to None :type polling_config: PollingConfig | None, optional :return: Devbox state info after it reaches running status - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ return self._client.devboxes.await_running(self._id, polling_config=polling_config) @@ -136,7 +136,7 @@ def await_suspended(self, *, polling_config: PollingConfig | None = None) -> Dev :param polling_config: Optional configuration for polling behavior (timeout, interval), defaults to None :type polling_config: PollingConfig | None, optional :return: Devbox state info after it reaches suspended status - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ return self._client.devboxes.await_suspended(self._id, polling_config=polling_config) @@ -148,7 +148,7 @@ def shutdown( :param options: Long-running request configuration (timeouts, retries, etc.) :return: Final devbox state info - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ return self._client.devboxes.shutdown( self._id, @@ -166,7 +166,7 @@ def suspend( :param options: Optional long-running request and polling configuration :return: Suspended devbox state info - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ self._client.devboxes.suspend( self._id, @@ -184,7 +184,7 @@ def resume( :param options: Optional long-running request and polling configuration :return: Resumed devbox state info - :rtype: DevboxView + :rtype: :class:`~runloop_api_client.types.devbox_view.DevboxView` """ self._client.devboxes.resume( self._id, @@ -504,7 +504,7 @@ def write( :param params: See :typeddict:`~runloop_api_client.sdk._types.SDKDevboxWriteFileContentsParams` for available parameters :return: Execution metadata for the write command - :rtype: DevboxExecutionDetailView + :rtype: :class:`~runloop_api_client.types.devbox_execution_detail_view.DevboxExecutionDetailView` Example: >>> devbox.file.write(file_path="/home/user/config.json", contents='{"key": "value"}') @@ -572,7 +572,7 @@ def create_ssh_key( :param options: Optional long-running request configuration :return: Response containing SSH connection info - :rtype: DevboxCreateSSHKeyResponse + :rtype: :class:`~runloop_api_client.types.devbox_create_ssh_key_response.DevboxCreateSSHKeyResponse` Example: >>> ssh_key = devbox.net.create_ssh_key() @@ -591,7 +591,7 @@ def create_tunnel( :param params: See :typeddict:`~runloop_api_client.sdk._types.SDKDevboxCreateTunnelParams` for available parameters :return: Details about the public endpoint - :rtype: DevboxTunnelView + :rtype: :class:`~runloop_api_client.types.devbox_tunnel_view.DevboxTunnelView` Example: >>> tunnel = devbox.net.create_tunnel(port=8080) diff --git a/src/runloop_api_client/sdk/execution.py b/src/runloop_api_client/sdk/execution.py index 3b59fd309..a17dff973 100644 --- a/src/runloop_api_client/sdk/execution.py +++ b/src/runloop_api_client/sdk/execution.py @@ -7,7 +7,7 @@ from typing import Optional from typing_extensions import Unpack, override -from ._types import RequestOptions, LongRequestOptions +from ._types import BaseRequestOptions, LongRequestOptions from .._client import Runloop from .execution_result import ExecutionResult from ..types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView @@ -107,7 +107,7 @@ def result(self, **options: Unpack[LongRequestOptions]) -> ExecutionResult: return ExecutionResult(self._client, self._devbox_id, final) - def get_state(self, **options: Unpack[RequestOptions]) -> DevboxAsyncExecutionDetailView: + def get_state(self, **options: Unpack[BaseRequestOptions]) -> DevboxAsyncExecutionDetailView: """Fetch the latest execution state. :param options: Optional request configuration diff --git a/src/runloop_api_client/sdk/snapshot.py b/src/runloop_api_client/sdk/snapshot.py index 81c654385..faa5a7636 100644 --- a/src/runloop_api_client/sdk/snapshot.py +++ b/src/runloop_api_client/sdk/snapshot.py @@ -5,7 +5,7 @@ from typing_extensions import Unpack, override from ._types import ( - RequestOptions, + BaseRequestOptions, LongRequestOptions, PollingRequestOptions, SDKDiskSnapshotUpdateParams, @@ -50,7 +50,7 @@ def id(self) -> str: def get_info( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> DevboxSnapshotAsyncStatusView: """Retrieve the latest snapshot status. diff --git a/src/runloop_api_client/sdk/storage_object.py b/src/runloop_api_client/sdk/storage_object.py index dbeed7f69..8eb4898b8 100644 --- a/src/runloop_api_client/sdk/storage_object.py +++ b/src/runloop_api_client/sdk/storage_object.py @@ -5,7 +5,7 @@ from typing import Iterable from typing_extensions import Unpack, override -from ._types import RequestOptions, LongRequestOptions, SDKObjectDownloadParams +from ._types import BaseRequestOptions, LongRequestOptions, SDKObjectDownloadParams from .._client import Runloop from ..types.object_view import ObjectView from ..types.object_download_url_view import ObjectDownloadURLView @@ -52,7 +52,7 @@ def upload_url(self) -> str | None: def refresh( self, - **options: Unpack[RequestOptions], + **options: Unpack[BaseRequestOptions], ) -> ObjectView: """Fetch the latest metadata for the object.