diff --git a/porter_sandbox/_models.py b/porter_sandbox/_models.py index 8e291d4..0a38263 100644 --- a/porter_sandbox/_models.py +++ b/porter_sandbox/_models.py @@ -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): diff --git a/porter_sandbox/sandboxes.py b/porter_sandbox/sandboxes.py index 886b0e9..8b1e561 100644 --- a/porter_sandbox/sandboxes.py +++ b/porter_sandbox/sandboxes.py @@ -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, @@ -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) @@ -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, @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 43e9ccc..b8b027a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/uv.lock b/uv.lock index 9010fd2..02ad474 100644 --- a/uv.lock +++ b/uv.lock @@ -345,7 +345,7 @@ wheels = [ [[package]] name = "porter-sandbox" -version = "0.1.32" +version = "0.1.35" source = { editable = "." } dependencies = [ { name = "httpx" },