Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions porter_sandbox/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ class SandboxSpec(BaseModel):
command: list[str] | None = Field(default=None, description="Override image entrypoint")
args: list[str] | None = Field(default=None, description="Arguments passed to the command")
env: dict[str, str] | None = Field(default=None, description="Environment variables to set in the sandbox, keyed by name")
env_groups: list[str] | None = Field(default=None, description="Names of environment groups on the cluster whose variables are\ninjected into the sandbox, resolved to their latest version at create\ntime. On a key conflict a later group wins over an earlier one, and\nan explicit env entry wins over any group value.\n")
volume_mounts: dict[str, str] | None = Field(default=None, description="Volumes to mount, keyed by the absolute mount path inside the\nsandbox; values are volume IDs.\n")
networking: list[SandboxNetworkingSpec] | None = Field(default=None, description="Network exposure for the sandbox. Omit to expose nothing. Currently\nonly one entry is supported.\n")
ttl_seconds: int | None = Field(default=None, description="Maximum lifetime in seconds, counted from creation. The sandbox is\nterminated once it elapses. Omit for no limit.\n")


class StatusResponse(BaseModel):
Expand Down
8 changes: 8 additions & 0 deletions porter_sandbox/sandboxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ def create(
command: list[str] | None = None,
args: list[str] | None = None,
env: dict[str, str] | None = None,
env_groups: list[str] | None = None,
volume_mounts: dict[str, str] | None = None,
networking: list[SandboxNetworkingSpec] | None = None,
ttl_seconds: int | None = None,
) -> Sandbox:
spec = SandboxSpec(
image=image,
Expand All @@ -42,8 +44,10 @@ def create(
command=command,
args=args,
env=env,
env_groups=env_groups,
volume_mounts=volume_mounts,
networking=networking,
ttl_seconds=ttl_seconds,
)
created = self._resource.create_sandbox(body=spec)
return Sandbox(id=created.id, resource=self._resource)
Expand Down Expand Up @@ -90,8 +94,10 @@ async def create(
command: list[str] | None = None,
args: list[str] | None = None,
env: dict[str, str] | None = None,
env_groups: list[str] | None = None,
volume_mounts: dict[str, str] | None = None,
networking: list[SandboxNetworkingSpec] | None = None,
ttl_seconds: int | None = None,
) -> AsyncSandbox:
spec = SandboxSpec(
image=image,
Expand All @@ -100,8 +106,10 @@ async def create(
command=command,
args=args,
env=env,
env_groups=env_groups,
volume_mounts=volume_mounts,
networking=networking,
ttl_seconds=ttl_seconds,
)
created = await self._resource.create_sandbox(body=spec)
return AsyncSandbox(id=created.id, resource=self._resource)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "porter-sandbox"
version = "0.1.32"
version = "0.1.35"
description = "Python SDK for the Porter Sandbox API"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading