From f9e63d96beac3fcdfda3b1038683ebf514b421d7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 20:38:22 +0000 Subject: [PATCH 1/6] feat(api): api update --- .stats.yml | 4 +- api.md | 1 + .../resources/devboxes/devboxes.py | 145 ++++++++++++++++++ src/runloop_api_client/types/__init__.py | 1 + .../types/devbox_execute_params.py | 28 ++++ tests/api_resources/test_devboxes.py | 112 ++++++++++++++ 6 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 src/runloop_api_client/types/devbox_execute_params.py diff --git a/.stats.yml b/.stats.yml index 1eaf9aeec..b38f3a8fb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 102 +configured_endpoints: 103 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f -config_hash: 457068371129b47b67f0f2d6b8267368 +config_hash: b9de5d96e095a7e749a8c1fc3536c308 diff --git a/api.md b/api.md index 3076ddf36..48aa81744 100644 --- a/api.md +++ b/api.md @@ -95,6 +95,7 @@ Methods: - client.devboxes.create_tunnel(id, \*\*params) -> DevboxTunnelView - client.devboxes.delete_disk_snapshot(id) -> object - client.devboxes.download_file(id, \*\*params) -> BinaryAPIResponse +- client.devboxes.execute(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_async(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_sync(id, \*\*params) -> DevboxExecutionDetailView - client.devboxes.keep_alive(id) -> object diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index 0d6b11d20..ec599e151 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -27,6 +27,7 @@ devbox_list_params, devbox_create_params, devbox_update_params, + devbox_execute_params, devbox_upload_file_params, devbox_execute_sync_params, devbox_create_tunnel_params, @@ -719,6 +720,72 @@ def download_file( cast_to=BinaryAPIResponse, ) + def execute( + self, + id: str, + *, + command: str, + command_id: str, + shell_name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Execute a command with a known command ID on a devbox, optimistically waiting + for it to complete within the specified timeout. If it completes in time, return + the result. If not, return a status indicating the command is still running. + + Args: + command: The command to execute via the Devbox shell. By default, commands are run from + the user home directory unless shell_name is specified. If shell_name is + specified the command is run from the directory based on the recent state of the + persistent shell. + + command_id: The command ID for idempotency and tracking + + shell_name: The name of the persistent shell to create or use if already created. When using + a persistent shell, the command will run from the directory at the end of the + previous command and environment variables will be preserved. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: + timeout = 600 + return self._post( + f"/v1/devboxes/{id}/execute", + body=maybe_transform( + { + "command": command, + "command_id": command_id, + "shell_name": shell_name, + }, + devbox_execute_params.DevboxExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + def execute_async( self, id: str, @@ -1981,6 +2048,72 @@ async def download_file( cast_to=AsyncBinaryAPIResponse, ) + async def execute( + self, + id: str, + *, + command: str, + command_id: str, + shell_name: Optional[str] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Execute a command with a known command ID on a devbox, optimistically waiting + for it to complete within the specified timeout. If it completes in time, return + the result. If not, return a status indicating the command is still running. + + Args: + command: The command to execute via the Devbox shell. By default, commands are run from + the user home directory unless shell_name is specified. If shell_name is + specified the command is run from the directory based on the recent state of the + persistent shell. + + command_id: The command ID for idempotency and tracking + + shell_name: The name of the persistent shell to create or use if already created. When using + a persistent shell, the command will run from the directory at the end of the + previous command and environment variables will be preserved. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: + timeout = 600 + return await self._post( + f"/v1/devboxes/{id}/execute", + body=await async_maybe_transform( + { + "command": command, + "command_id": command_id, + "shell_name": shell_name, + }, + devbox_execute_params.DevboxExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + async def execute_async( self, id: str, @@ -2690,6 +2823,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.download_file, BinaryAPIResponse, ) + self.execute = to_raw_response_wrapper( + devboxes.execute, + ) self.execute_async = to_raw_response_wrapper( devboxes.execute_async, ) @@ -2784,6 +2920,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.download_file, AsyncBinaryAPIResponse, ) + self.execute = async_to_raw_response_wrapper( + devboxes.execute, + ) self.execute_async = async_to_raw_response_wrapper( devboxes.execute_async, ) @@ -2878,6 +3017,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.download_file, StreamedBinaryAPIResponse, ) + self.execute = to_streamed_response_wrapper( + devboxes.execute, + ) self.execute_async = to_streamed_response_wrapper( devboxes.execute_async, ) @@ -2972,6 +3114,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.download_file, AsyncStreamedBinaryAPIResponse, ) + self.execute = async_to_streamed_response_wrapper( + devboxes.execute, + ) self.execute_async = async_to_streamed_response_wrapper( devboxes.execute_async, ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index e57d0b026..8b097686f 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -41,6 +41,7 @@ from .secret_update_params import SecretUpdateParams as SecretUpdateParams from .benchmark_list_params import BenchmarkListParams as BenchmarkListParams from .blueprint_list_params import BlueprintListParams as BlueprintListParams +from .devbox_execute_params import DevboxExecuteParams as DevboxExecuteParams from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView from .object_download_params import ObjectDownloadParams as ObjectDownloadParams from .repository_list_params import RepositoryListParams as RepositoryListParams diff --git a/src/runloop_api_client/types/devbox_execute_params.py b/src/runloop_api_client/types/devbox_execute_params.py new file mode 100644 index 000000000..6ac9d3632 --- /dev/null +++ b/src/runloop_api_client/types/devbox_execute_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["DevboxExecuteParams"] + + +class DevboxExecuteParams(TypedDict, total=False): + command: Required[str] + """The command to execute via the Devbox shell. + + By default, commands are run from the user home directory unless shell_name is + specified. If shell_name is specified the command is run from the directory + based on the recent state of the persistent shell. + """ + + command_id: Required[str] + """The command ID for idempotency and tracking""" + + shell_name: Optional[str] + """The name of the persistent shell to create or use if already created. + + When using a persistent shell, the command will run from the directory at the + end of the previous command and environment variables will be preserved. + """ diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index dfe1f1cbb..7fa586e9a 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -405,6 +405,62 @@ def test_path_params_download_file(self, client: Runloop) -> None: path="path", ) + @parametrize + def test_method_execute(self, client: Runloop) -> None: + devbox = client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_method_execute_with_all_params(self, client: Runloop) -> None: + devbox = client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + shell_name="shell_name", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_raw_response_execute(self, client: Runloop) -> None: + response = client.devboxes.with_raw_response.execute( + id="id", + command="command", + command_id="command_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_streaming_response_execute(self, client: Runloop) -> None: + with client.devboxes.with_streaming_response.execute( + id="id", + command="command", + command_id="command_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_execute(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.with_raw_response.execute( + id="", + command="command", + command_id="command_id", + ) + @parametrize def test_method_execute_async(self, client: Runloop) -> None: devbox = client.devboxes.execute_async( @@ -1625,6 +1681,62 @@ async def test_path_params_download_file(self, async_client: AsyncRunloop) -> No path="path", ) + @parametrize + async def test_method_execute(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_method_execute_with_all_params(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + shell_name="shell_name", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_raw_response_execute(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.with_raw_response.execute( + id="id", + command="command", + command_id="command_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_streaming_response_execute(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.with_streaming_response.execute( + id="id", + command="command", + command_id="command_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_execute(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.with_raw_response.execute( + id="", + command="command", + command_id="command_id", + ) + @parametrize async def test_method_execute_async(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.execute_async( From 5d1797b1e193ffd5b17c664fdf3894a568039c14 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 22:13:13 +0000 Subject: [PATCH 2/6] feat(api): api update --- .stats.yml | 4 +- api.md | 1 + .../resources/devboxes/devboxes.py | 135 +++++++++++++++++- src/runloop_api_client/types/__init__.py | 1 + .../types/devbox_wait_for_command_params.py | 29 ++++ tests/api_resources/test_devboxes.py | 102 +++++++++++++ 6 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 src/runloop_api_client/types/devbox_wait_for_command_params.py diff --git a/.stats.yml b/.stats.yml index b38f3a8fb..5b0137e10 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 103 +configured_endpoints: 104 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f -config_hash: b9de5d96e095a7e749a8c1fc3536c308 +config_hash: 98a0f112ecc9445456962dab3136d7b6 diff --git a/api.md b/api.md index 48aa81744..7ec7d6671 100644 --- a/api.md +++ b/api.md @@ -108,6 +108,7 @@ Methods: - client.devboxes.snapshot_disk_async(id, \*\*params) -> DevboxSnapshotView - client.devboxes.suspend(id) -> DevboxView - client.devboxes.upload_file(id, \*\*params) -> object +- client.devboxes.wait_for_command(id, \*\*params) -> DevboxView - client.devboxes.write_file_contents(id, \*\*params) -> DevboxExecutionDetailView diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index ec599e151..dd8e61e5b 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Mapping, Iterable, Optional, TypedDict, cast +from typing import Dict, List, Mapping, Iterable, Optional, TypedDict, cast from typing_extensions import Literal import httpx @@ -35,6 +35,7 @@ devbox_execute_async_params, devbox_remove_tunnel_params, devbox_snapshot_disk_params, + devbox_wait_for_command_params, devbox_read_file_contents_params, devbox_list_disk_snapshots_params, devbox_snapshot_disk_async_params, @@ -1407,6 +1408,66 @@ def upload_file( cast_to=object, ) + def wait_for_command( + self, + id: str, + *, + statuses: List[ + Literal[ + "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" + ] + ], + timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DevboxView: + """ + Polls the Devbox's status until it reaches one of the desired statuses or times + out. + + Args: + statuses: The Devbox statuses to wait for. At least one status must be provided. The + devbox will be returned as soon as it reaches any of the provided statuses. + + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults + to 10 seconds. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return self._post( + f"/v1/devboxes/{id}/wait_for_status", + body=maybe_transform( + { + "statuses": statuses, + "timeout_seconds": timeout_seconds, + }, + devbox_wait_for_command_params.DevboxWaitForCommandParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxView, + ) + def write_file_contents( self, id: str, @@ -2735,6 +2796,66 @@ async def upload_file( cast_to=object, ) + async def wait_for_command( + self, + id: str, + *, + statuses: List[ + Literal[ + "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" + ] + ], + timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + idempotency_key: str | None = None, + ) -> DevboxView: + """ + Polls the Devbox's status until it reaches one of the desired statuses or times + out. + + Args: + statuses: The Devbox statuses to wait for. At least one status must be provided. The + devbox will be returned as soon as it reaches any of the provided statuses. + + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults + to 10 seconds. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + return await self._post( + f"/v1/devboxes/{id}/wait_for_status", + body=await async_maybe_transform( + { + "statuses": statuses, + "timeout_seconds": timeout_seconds, + }, + devbox_wait_for_command_params.DevboxWaitForCommandParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxView, + ) + async def write_file_contents( self, id: str, @@ -2862,6 +2983,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.upload_file = to_raw_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = to_raw_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = to_raw_response_wrapper( devboxes.write_file_contents, ) @@ -2959,6 +3083,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.upload_file = async_to_raw_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = async_to_raw_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = async_to_raw_response_wrapper( devboxes.write_file_contents, ) @@ -3056,6 +3183,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.upload_file = to_streamed_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = to_streamed_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = to_streamed_response_wrapper( devboxes.write_file_contents, ) @@ -3153,6 +3283,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.upload_file = async_to_streamed_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = async_to_streamed_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = async_to_streamed_response_wrapper( devboxes.write_file_contents, ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index 8b097686f..4bae9f954 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -86,6 +86,7 @@ from .scoring_contract_update_param import ScoringContractUpdateParam as ScoringContractUpdateParam from .blueprint_build_logs_list_view import BlueprintBuildLogsListView as BlueprintBuildLogsListView from .devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse as DevboxCreateSSHKeyResponse +from .devbox_wait_for_command_params import DevboxWaitForCommandParams as DevboxWaitForCommandParams from .repository_connection_list_view import RepositoryConnectionListView as RepositoryConnectionListView from .repository_inspection_list_view import RepositoryInspectionListView as RepositoryInspectionListView from .devbox_read_file_contents_params import DevboxReadFileContentsParams as DevboxReadFileContentsParams diff --git a/src/runloop_api_client/types/devbox_wait_for_command_params.py b/src/runloop_api_client/types/devbox_wait_for_command_params.py new file mode 100644 index 000000000..fa50a1f87 --- /dev/null +++ b/src/runloop_api_client/types/devbox_wait_for_command_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["DevboxWaitForCommandParams"] + + +class DevboxWaitForCommandParams(TypedDict, total=False): + statuses: Required[ + List[ + Literal[ + "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" + ] + ] + ] + """The Devbox statuses to wait for. + + At least one status must be provided. The devbox will be returned as soon as it + reaches any of the provided statuses. + """ + + timeout_seconds: Optional[int] + """(Optional) Timeout in seconds to wait for the status, up to 30 seconds. + + Defaults to 10 seconds. + """ diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index 7fa586e9a..f27ca521a 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -980,6 +980,57 @@ def test_path_params_upload_file(self, client: Runloop) -> None: path="path", ) + @parametrize + def test_method_wait_for_command(self, client: Runloop) -> None: + devbox = client.devboxes.wait_for_command( + id="id", + statuses=["provisioning"], + ) + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + def test_method_wait_for_command_with_all_params(self, client: Runloop) -> None: + devbox = client.devboxes.wait_for_command( + id="id", + statuses=["provisioning"], + timeout_seconds=0, + ) + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + def test_raw_response_wait_for_command(self, client: Runloop) -> None: + response = client.devboxes.with_raw_response.wait_for_command( + id="id", + statuses=["provisioning"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = response.parse() + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + def test_streaming_response_wait_for_command(self, client: Runloop) -> None: + with client.devboxes.with_streaming_response.wait_for_command( + id="id", + statuses=["provisioning"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = response.parse() + assert_matches_type(DevboxView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_wait_for_command(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.with_raw_response.wait_for_command( + id="", + statuses=["provisioning"], + ) + @parametrize def test_method_write_file_contents(self, client: Runloop) -> None: devbox = client.devboxes.write_file_contents( @@ -2256,6 +2307,57 @@ async def test_path_params_upload_file(self, async_client: AsyncRunloop) -> None path="path", ) + @parametrize + async def test_method_wait_for_command(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.wait_for_command( + id="id", + statuses=["provisioning"], + ) + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + async def test_method_wait_for_command_with_all_params(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.wait_for_command( + id="id", + statuses=["provisioning"], + timeout_seconds=0, + ) + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + async def test_raw_response_wait_for_command(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.with_raw_response.wait_for_command( + id="id", + statuses=["provisioning"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = await response.parse() + assert_matches_type(DevboxView, devbox, path=["response"]) + + @parametrize + async def test_streaming_response_wait_for_command(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.with_streaming_response.wait_for_command( + id="id", + statuses=["provisioning"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = await response.parse() + assert_matches_type(DevboxView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_wait_for_command(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.with_raw_response.wait_for_command( + id="", + statuses=["provisioning"], + ) + @parametrize async def test_method_write_file_contents(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.write_file_contents( From 82b700156bc034cb486225ef2889b7f3b7575c9e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 17:43:55 +0000 Subject: [PATCH 3/6] feat(api): api update --- .stats.yml | 2 +- api.md | 2 +- .../resources/devboxes/devboxes.py | 68 +++++++-------- .../types/devbox_wait_for_command_params.py | 20 ++--- tests/api_resources/test_devboxes.py | 84 ++++++++++++------- 5 files changed, 98 insertions(+), 78 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5b0137e10..e4cd2f7e7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f -config_hash: 98a0f112ecc9445456962dab3136d7b6 +config_hash: 3a4634de0976f3fbd7f3a5c4911d2add diff --git a/api.md b/api.md index 7ec7d6671..1504da149 100644 --- a/api.md +++ b/api.md @@ -108,7 +108,7 @@ Methods: - client.devboxes.snapshot_disk_async(id, \*\*params) -> DevboxSnapshotView - client.devboxes.suspend(id) -> DevboxView - client.devboxes.upload_file(id, \*\*params) -> object -- client.devboxes.wait_for_command(id, \*\*params) -> DevboxView +- client.devboxes.wait_for_command(execution_id, \*, devbox_id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.write_file_contents(id, \*\*params) -> DevboxExecutionDetailView diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index dd8e61e5b..3046c4ce7 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -1410,13 +1410,10 @@ def upload_file( def wait_for_command( self, - id: str, + execution_id: str, *, - statuses: List[ - Literal[ - "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" - ] - ], + devbox_id: str, + statuses: List[Literal["queued", "running", "completed"]], timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1425,17 +1422,18 @@ def wait_for_command( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, - ) -> DevboxView: + ) -> DevboxAsyncExecutionDetailView: """ - Polls the Devbox's status until it reaches one of the desired statuses or times - out. + Polls the asynchronous execution's status until it reaches one of the desired + statuses or times out. Defaults to 60 seconds. Args: - statuses: The Devbox statuses to wait for. At least one status must be provided. The - devbox will be returned as soon as it reaches any of the provided statuses. + statuses: The command execution statuses to wait for. At least one status must be + provided. The command will be returned as soon as it reaches any of the provided + statuses. - timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults - to 10 seconds. + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults + to 60 seconds. extra_headers: Send extra headers @@ -1447,10 +1445,12 @@ def wait_for_command( idempotency_key: Specify a custom idempotency key for this request """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not devbox_id: + raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}") + if not execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return self._post( - f"/v1/devboxes/{id}/wait_for_status", + f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status", body=maybe_transform( { "statuses": statuses, @@ -1465,7 +1465,7 @@ def wait_for_command( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=DevboxView, + cast_to=DevboxAsyncExecutionDetailView, ) def write_file_contents( @@ -2798,13 +2798,10 @@ async def upload_file( async def wait_for_command( self, - id: str, + execution_id: str, *, - statuses: List[ - Literal[ - "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" - ] - ], + devbox_id: str, + statuses: List[Literal["queued", "running", "completed"]], timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -2813,17 +2810,18 @@ async def wait_for_command( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, idempotency_key: str | None = None, - ) -> DevboxView: + ) -> DevboxAsyncExecutionDetailView: """ - Polls the Devbox's status until it reaches one of the desired statuses or times - out. + Polls the asynchronous execution's status until it reaches one of the desired + statuses or times out. Defaults to 60 seconds. Args: - statuses: The Devbox statuses to wait for. At least one status must be provided. The - devbox will be returned as soon as it reaches any of the provided statuses. + statuses: The command execution statuses to wait for. At least one status must be + provided. The command will be returned as soon as it reaches any of the provided + statuses. - timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults - to 10 seconds. + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults + to 60 seconds. extra_headers: Send extra headers @@ -2835,10 +2833,12 @@ async def wait_for_command( idempotency_key: Specify a custom idempotency key for this request """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not devbox_id: + raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}") + if not execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") return await self._post( - f"/v1/devboxes/{id}/wait_for_status", + f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status", body=await async_maybe_transform( { "statuses": statuses, @@ -2853,7 +2853,7 @@ async def wait_for_command( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=DevboxView, + cast_to=DevboxAsyncExecutionDetailView, ) async def write_file_contents( diff --git a/src/runloop_api_client/types/devbox_wait_for_command_params.py b/src/runloop_api_client/types/devbox_wait_for_command_params.py index fa50a1f87..93cf7e1e5 100644 --- a/src/runloop_api_client/types/devbox_wait_for_command_params.py +++ b/src/runloop_api_client/types/devbox_wait_for_command_params.py @@ -9,21 +9,17 @@ class DevboxWaitForCommandParams(TypedDict, total=False): - statuses: Required[ - List[ - Literal[ - "provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown" - ] - ] - ] - """The Devbox statuses to wait for. - - At least one status must be provided. The devbox will be returned as soon as it + devbox_id: Required[str] + + statuses: Required[List[Literal["queued", "running", "completed"]]] + """The command execution statuses to wait for. + + At least one status must be provided. The command will be returned as soon as it reaches any of the provided statuses. """ timeout_seconds: Optional[int] - """(Optional) Timeout in seconds to wait for the status, up to 30 seconds. + """(Optional) Timeout in seconds to wait for the status, up to 60 seconds. - Defaults to 10 seconds. + Defaults to 60 seconds. """ diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index f27ca521a..c638b064f 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -983,52 +983,64 @@ def test_path_params_upload_file(self, client: Runloop) -> None: @parametrize def test_method_wait_for_command(self, client: Runloop) -> None: devbox = client.devboxes.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize def test_method_wait_for_command_with_all_params(self, client: Runloop) -> None: devbox = client.devboxes.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], timeout_seconds=0, ) - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize def test_raw_response_wait_for_command(self, client: Runloop) -> None: response = client.devboxes.with_raw_response.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize def test_streaming_response_wait_for_command(self, client: Runloop) -> None: with client.devboxes.with_streaming_response.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_wait_for_command(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"): client.devboxes.with_raw_response.wait_for_command( - id="", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="", + statuses=["queued"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): + client.devboxes.with_raw_response.wait_for_command( + execution_id="", + devbox_id="devbox_id", + statuses=["queued"], ) @parametrize @@ -2310,52 +2322,64 @@ async def test_path_params_upload_file(self, async_client: AsyncRunloop) -> None @parametrize async def test_method_wait_for_command(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize async def test_method_wait_for_command_with_all_params(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], timeout_seconds=0, ) - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize async def test_raw_response_wait_for_command(self, async_client: AsyncRunloop) -> None: response = await async_client.devboxes.with_raw_response.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) @parametrize async def test_streaming_response_wait_for_command(self, async_client: AsyncRunloop) -> None: async with async_client.devboxes.with_streaming_response.wait_for_command( - id="id", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxView, devbox, path=["response"]) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_wait_for_command(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"): await async_client.devboxes.with_raw_response.wait_for_command( - id="", - statuses=["provisioning"], + execution_id="execution_id", + devbox_id="", + statuses=["queued"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): + await async_client.devboxes.with_raw_response.wait_for_command( + execution_id="", + devbox_id="devbox_id", + statuses=["queued"], ) @parametrize From 177918449f2065eb1c9005b9b98183154c602efa Mon Sep 17 00:00:00 2001 From: meorphis Date: Wed, 10 Sep 2025 13:50:19 -0400 Subject: [PATCH 4/6] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e4cd2f7e7..00e38fa1c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml -openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-0cb966ca566f4f3d7f8b4d3c37b24b4a117760dba194cb2c4f2bb4e3620027de.yml +openapi_spec_hash: c969887eb721b42a423e662127270d57 config_hash: 3a4634de0976f3fbd7f3a5c4911d2add From 1d24df459ca3ad9daf48ac54c5939491d78c2252 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 20:48:47 +0000 Subject: [PATCH 5/6] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 00e38fa1c..bfc06aa5b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 104 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-0cb966ca566f4f3d7f8b4d3c37b24b4a117760dba194cb2c4f2bb4e3620027de.yml openapi_spec_hash: c969887eb721b42a423e662127270d57 -config_hash: 3a4634de0976f3fbd7f3a5c4911d2add +config_hash: 103c1928ef462db5a22f26ca92caf7fe From 3c5d9c0779926e914cee9d25fa7995e6e4f3d44e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 21:14:46 +0000 Subject: [PATCH 6/6] release: 0.60.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ pyproject.toml | 2 +- src/runloop_api_client/_version.py | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 85c311828..284ce936c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.59.0" + ".": "0.60.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b00c7c10..9d9721d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.60.0 (2025-09-10) + +Full Changelog: [v0.59.0...v0.60.0](https://github.com/runloopai/api-client-python/compare/v0.59.0...v0.60.0) + +### Features + +* **api:** api update ([82b7001](https://github.com/runloopai/api-client-python/commit/82b700156bc034cb486225ef2889b7f3b7575c9e)) +* **api:** api update ([5d1797b](https://github.com/runloopai/api-client-python/commit/5d1797b1e193ffd5b17c664fdf3894a568039c14)) +* **api:** api update ([f9e63d9](https://github.com/runloopai/api-client-python/commit/f9e63d96beac3fcdfda3b1038683ebf514b421d7)) + ## 0.59.0 (2025-09-08) Full Changelog: [v0.58.0...v0.59.0](https://github.com/runloopai/api-client-python/compare/v0.58.0...v0.59.0) diff --git a/pyproject.toml b/pyproject.toml index 3aef4322c..9ff52932e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runloop_api_client" -version = "0.59.0" +version = "0.60.0" description = "The official Python library for the runloop API" dynamic = ["readme"] license = "MIT" diff --git a/src/runloop_api_client/_version.py b/src/runloop_api_client/_version.py index 533907a8a..23fb0da51 100644 --- a/src/runloop_api_client/_version.py +++ b/src/runloop_api_client/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "runloop_api_client" -__version__ = "0.59.0" # x-release-please-version +__version__ = "0.60.0" # x-release-please-version