Skip to content

Commit 2288136

Browse files
committed
update args, need to fix basedpyright
1 parent 27ecd77 commit 2288136

3 files changed

Lines changed: 21 additions & 219 deletions

File tree

src/runloop_api_client/resources/blueprints.py

Lines changed: 10 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -212,35 +212,16 @@ def is_done_building(blueprint: BlueprintView) -> bool:
212212
def create_and_await_build_complete(
213213
self,
214214
*,
215-
name: str,
216-
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
217-
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
218-
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
219-
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
220-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
215+
create_args: blueprint_create_params.BlueprintCreateParams,
221216
polling_config: PollingConfig | None = None,
222-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
223-
# The extra values given here take precedence over values defined on the client or passed to this method.
224-
extra_headers: Headers | None = None,
225-
extra_query: Query | None = None,
226-
extra_body: Body | None = None,
227-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
228-
idempotency_key: str | None = None,
229217
) -> BlueprintView:
230218
"""Create a new Blueprint and wait for it to finish building.
231219
220+
This is a wrapper around the `create` method that waits for the blueprint to finish building.
221+
232222
Args:
233-
dockerfile: The Dockerfile contents to use for building the Blueprint
234-
file_mounts: Files to mount into the Blueprint
235-
launch_parameters: Launch parameters for Devboxes created from this Blueprint
236-
name: Name for the Blueprint
237-
system_setup_commands: Commands to run during Blueprint build
223+
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
238224
polling_config: Optional polling configuration
239-
extra_headers: Send extra headers
240-
extra_query: Add additional query parameters to the request
241-
extra_body: Add additional JSON properties to the request
242-
timeout: Override the client-level default timeout for this request, in seconds
243-
idempotency_key: Specify a custom idempotency key for this request
244225
245226
Returns:
246227
The built blueprint
@@ -249,27 +230,11 @@ def create_and_await_build_complete(
249230
PollingTimeout: If polling times out before blueprint is built
250231
RunloopError: If blueprint enters a non-built terminal state
251232
"""
252-
blueprint = self.create(
253-
name=name,
254-
dockerfile=dockerfile,
255-
code_mounts=code_mounts,
256-
file_mounts=file_mounts,
257-
launch_parameters=launch_parameters,
258-
system_setup_commands=system_setup_commands,
259-
extra_headers=extra_headers,
260-
extra_query=extra_query,
261-
extra_body=extra_body,
262-
timeout=timeout,
263-
idempotency_key=idempotency_key,
264-
)
233+
blueprint = self.create(**create_args)
265234

266235
return self.await_build_complete(
267236
blueprint.id,
268237
polling_config=polling_config,
269-
extra_headers=extra_headers,
270-
extra_query=extra_query,
271-
extra_body=extra_body,
272-
timeout=timeout,
273238
)
274239

275240
def list(
@@ -651,35 +616,16 @@ def is_done_building(blueprint: BlueprintView) -> bool:
651616
async def create_and_await_build_complete(
652617
self,
653618
*,
654-
name: str,
655-
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
656-
dockerfile: Optional[str] | NotGiven = NOT_GIVEN,
657-
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
658-
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
659-
system_setup_commands: Optional[List[str]] | NotGiven = NOT_GIVEN,
619+
create_args: blueprint_create_params.BlueprintCreateParams,
660620
polling_config: PollingConfig | None = None,
661-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
662-
# The extra values given here take precedence over values defined on the client or passed to this method.
663-
extra_headers: Headers | None = None,
664-
extra_query: Query | None = None,
665-
extra_body: Body | None = None,
666-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
667-
idempotency_key: str | None = None,
668621
) -> BlueprintView:
669622
"""Create a new Blueprint and wait for it to finish building.
670623
624+
This is a wrapper around the `create` method that waits for the blueprint to finish building.
625+
671626
Args:
672-
dockerfile: The Dockerfile contents to use for building the Blueprint
673-
file_mounts: Files to mount into the Blueprint
674-
launch_parameters: Launch parameters for Devboxes created from this Blueprint
675-
name: Name for the Blueprint
676-
system_setup_commands: Commands to run during Blueprint build
627+
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
677628
polling_config: Optional polling configuration
678-
extra_headers: Send extra headers
679-
extra_query: Add additional query parameters to the request
680-
extra_body: Add additional JSON properties to the request
681-
timeout: Override the client-level default timeout for this request, in seconds
682-
idempotency_key: Specify a custom idempotency key for this request
683629
684630
Returns:
685631
The built blueprint
@@ -688,27 +634,11 @@ async def create_and_await_build_complete(
688634
PollingTimeout: If polling times out before blueprint is built
689635
RunloopError: If blueprint enters a non-built terminal state
690636
"""
691-
blueprint = await self.create(
692-
name=name,
693-
dockerfile=dockerfile,
694-
code_mounts=code_mounts,
695-
file_mounts=file_mounts,
696-
launch_parameters=launch_parameters,
697-
system_setup_commands=system_setup_commands,
698-
extra_headers=extra_headers,
699-
extra_query=extra_query,
700-
extra_body=extra_body,
701-
timeout=timeout,
702-
idempotency_key=idempotency_key,
703-
)
637+
blueprint = await self.create(**create_args)
704638

705639
return await self.await_build_complete(
706640
blueprint.id,
707641
polling_config=polling_config,
708-
extra_headers=extra_headers,
709-
extra_query=extra_query,
710-
extra_body=extra_body,
711-
timeout=timeout,
712642
)
713643

714644
def list(

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 10 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -426,61 +426,16 @@ def is_done_booting(devbox: DevboxView) -> bool:
426426
def create_and_await_running(
427427
self,
428428
*,
429-
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
430-
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
431-
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
432-
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
433-
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
434-
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
435-
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
436-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
437-
name: Optional[str] | NotGiven = NOT_GIVEN,
438-
prebuilt: Optional[str] | NotGiven = NOT_GIVEN,
439-
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
440-
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
441-
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
429+
create_args: devbox_create_params.DevboxCreateParams,
442430
polling_config: PollingConfig | None = None,
443-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
444-
# The extra values given here take precedence over values defined on the client or passed to this method.
445-
extra_headers: Headers | None = None,
446-
extra_query: Query | None = None,
447-
extra_body: Body | None = None,
448-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
449-
idempotency_key: str | None = None,
450431
) -> DevboxView:
451432
"""Create a new devbox and wait for it to be in running state.
452433
434+
This is a wrapper around the `create` method that waits for the devbox to reach running state.
435+
453436
Args:
454-
blueprint_id: Blueprint ID to use for the Devbox. If none set, the Devbox will be created with
455-
the default Runloop Devbox image. Only one of (Snapshot ID, Blueprint ID,
456-
Blueprint name) should be specified.
457-
blueprint_name: Name of Blueprint to use for the Devbox. When set, this will load the latest
458-
successfully built Blueprint with the given name. Only one of (Snapshot ID,
459-
Blueprint ID, Blueprint name) should be specified.
460-
code_mounts: A list of code mounts to be included in the Devbox.
461-
entrypoint: (Optional) When specified, the Devbox will run this script as its main
462-
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
463-
the process is complete.
464-
environment_variables: (Optional) Environment variables used to configure your Devbox.
465-
file_mounts: (Optional) Map of paths and file contents to write before setup.
466-
launch_parameters: Parameters to configure the resources and launch time behavior of the Devbox.
467-
metadata: User defined metadata to attach to the devbox for organization.
468-
name: (Optional) A user specified name to give the Devbox.
469-
prebuilt: Reference to prebuilt Blueprint to create the Devbox from. Should not be used
470-
together with (Snapshot ID, Blueprint ID, or Blueprint name).
471-
repo_connection_id: Repository connection id the devbox should source its base image from.
472-
secrets: (Optional) Map of environment variable names to secret names. The secret values
473-
will be securely injected as environment variables in the Devbox. Example:
474-
{"DB_PASS": "DATABASE_PASSWORD"} sets environment variable 'DB_PASS' to the
475-
value of secret 'DATABASE_PASSWORD'.
476-
snapshot_id: Snapshot ID to use for the Devbox. Only one of (Snapshot ID, Blueprint ID,
477-
Blueprint name) should be specified.
437+
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
478438
polling_config: Optional polling configuration
479-
extra_headers: Send extra headers
480-
extra_query: Add additional query parameters to the request
481-
extra_body: Add additional JSON properties to the request
482-
timeout: Override the client-level default timeout for this request, in seconds
483-
idempotency_key: Specify a custom idempotency key for this request
484439
485440
Returns:
486441
The devbox in running state
@@ -489,26 +444,7 @@ def create_and_await_running(
489444
PollingTimeout: If polling times out before devbox is running
490445
RunloopError: If devbox enters a non-running terminal state
491446
"""
492-
devbox = self.create(
493-
blueprint_id=blueprint_id,
494-
blueprint_name=blueprint_name,
495-
code_mounts=code_mounts,
496-
entrypoint=entrypoint,
497-
environment_variables=environment_variables,
498-
file_mounts=file_mounts,
499-
launch_parameters=launch_parameters,
500-
metadata=metadata,
501-
name=name,
502-
prebuilt=prebuilt,
503-
repo_connection_id=repo_connection_id,
504-
secrets=secrets,
505-
snapshot_id=snapshot_id,
506-
extra_headers=extra_headers,
507-
extra_query=extra_query,
508-
extra_body=extra_body,
509-
timeout=timeout,
510-
idempotency_key=idempotency_key,
511-
)
447+
devbox = self.create(**create_args)
512448

513449
return self.await_running(
514450
devbox.id,
@@ -1632,61 +1568,16 @@ async def retrieve(
16321568
async def create_and_await_running(
16331569
self,
16341570
*,
1635-
blueprint_id: Optional[str] | NotGiven = NOT_GIVEN,
1636-
blueprint_name: Optional[str] | NotGiven = NOT_GIVEN,
1637-
code_mounts: Optional[Iterable[CodeMountParameters]] | NotGiven = NOT_GIVEN,
1638-
entrypoint: Optional[str] | NotGiven = NOT_GIVEN,
1639-
environment_variables: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1640-
file_mounts: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1641-
launch_parameters: Optional[LaunchParameters] | NotGiven = NOT_GIVEN,
1642-
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1643-
name: Optional[str] | NotGiven = NOT_GIVEN,
1644-
prebuilt: Optional[str] | NotGiven = NOT_GIVEN,
1645-
repo_connection_id: Optional[str] | NotGiven = NOT_GIVEN,
1646-
secrets: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
1647-
snapshot_id: Optional[str] | NotGiven = NOT_GIVEN,
1571+
create_args: devbox_create_params.DevboxCreateParams,
16481572
polling_config: PollingConfig | None = None,
1649-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1650-
# The extra values given here take precedence over values defined on the client or passed to this method.
1651-
extra_headers: Headers | None = None,
1652-
extra_query: Query | None = None,
1653-
extra_body: Body | None = None,
1654-
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1655-
idempotency_key: str | None = None,
16561573
) -> DevboxView:
16571574
"""Create a devbox and wait for it to be in running state.
16581575
1576+
This is a wrapper around the `create` method that waits for the devbox to reach running state.
1577+
16591578
Args:
1660-
blueprint_id: Blueprint ID to use for the Devbox. If none set, the Devbox will be created with
1661-
the default Runloop Devbox image. Only one of (Snapshot ID, Blueprint ID,
1662-
Blueprint name) should be specified.
1663-
blueprint_name: Name of Blueprint to use for the Devbox. When set, this will load the latest
1664-
successfully built Blueprint with the given name. Only one of (Snapshot ID,
1665-
Blueprint ID, Blueprint name) should be specified.
1666-
code_mounts: A list of code mounts to be included in the Devbox.
1667-
entrypoint: (Optional) When specified, the Devbox will run this script as its main
1668-
executable. The devbox lifecycle will be bound to entrypoint, shutting down when
1669-
the process is complete.
1670-
environment_variables: (Optional) Environment variables used to configure your Devbox.
1671-
file_mounts: (Optional) Map of paths and file contents to write before setup.
1672-
launch_parameters: Parameters to configure the resources and launch time behavior of the Devbox.
1673-
metadata: User defined metadata to attach to the devbox for organization.
1674-
name: (Optional) A user specified name to give the Devbox.
1675-
prebuilt: Reference to prebuilt Blueprint to create the Devbox from. Should not be used
1676-
together with (Snapshot ID, Blueprint ID, or Blueprint name).
1677-
repo_connection_id: Repository connection id the devbox should source its base image from.
1678-
secrets: (Optional) Map of environment variable names to secret names. The secret values
1679-
will be securely injected as environment variables in the Devbox. Example:
1680-
{"DB_PASS": "DATABASE_PASSWORD"} sets environment variable 'DB_PASS' to the
1681-
value of secret 'DATABASE_PASSWORD'.
1682-
snapshot_id: Snapshot ID to use for the Devbox. Only one of (Snapshot ID, Blueprint ID,
1683-
Blueprint name) should be specified.
1579+
create_args: Arguments to pass to the `create` method. See the `create` method for detailed documentation.
16841580
polling_config: Optional polling configuration
1685-
extra_headers: Send extra headers
1686-
extra_query: Add additional query parameters to the request
1687-
extra_body: Add additional JSON properties to the request
1688-
timeout: Override the client-level default timeout for this request, in seconds
1689-
idempotency_key: Specify a custom idempotency key for this request
16901581
16911582
Returns:
16921583
The devbox in running state
@@ -1695,26 +1586,7 @@ async def create_and_await_running(
16951586
PollingTimeout: If polling times out before devbox is running
16961587
RunloopError: If devbox enters a non-running terminal state
16971588
"""
1698-
devbox = await self.create(
1699-
blueprint_id=blueprint_id,
1700-
blueprint_name=blueprint_name,
1701-
code_mounts=code_mounts,
1702-
entrypoint=entrypoint,
1703-
environment_variables=environment_variables,
1704-
file_mounts=file_mounts,
1705-
launch_parameters=launch_parameters,
1706-
metadata=metadata,
1707-
name=name,
1708-
prebuilt=prebuilt,
1709-
repo_connection_id=repo_connection_id,
1710-
secrets=secrets,
1711-
snapshot_id=snapshot_id,
1712-
extra_headers=extra_headers,
1713-
extra_query=extra_query,
1714-
extra_body=extra_body,
1715-
timeout=timeout,
1716-
idempotency_key=idempotency_key,
1717-
)
1589+
devbox = await self.create(**create_args)
17181590

17191591
return await self.await_running(
17201592
devbox.id,

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)