baseten.sandboxΒΆ
Create and work with Baseten sandboxes.
Create one SandboxClient up front and reuse it, then create a sandbox
and run a command in it:
from baseten.sandbox import SandboxClient
with SandboxClient(api_key="my-api-key") as client:
sandbox = client.create()
process = sandbox.process.exec(
command="echo hello", wait_for_completion=True
)
print(process.stdout)
AsyncSandboxClient is the same for async code. HTTP/2 is used when the
h2 package is installed, which is recommended: pip install
"httpx[http2]".
Classes
Async form of |
|
Async form of |
|
Async form of |
|
Async form of |
|
Async form of |
|
A sandbox's previews, which expose its ports on HTTPS URLs. |
|
Async form of |
|
Async form of |
|
An image described as a Dockerfile and the files it copies in. |
|
Result of |
|
Images that sandboxes are created from. |
|
A candidate path in a directory being pushed, for an ignore function. |
|
A |
|
An image repository as last reported by the control plane. |
|
A built-in image available to every team. |
|
A volume attachment a built-in image suggests, in |
|
One line of an image's build log, from |
|
One version of an image. |
|
One sandbox, to run processes and work with files in. |
|
Client for Baseten sandboxes. |
|
Options for |
|
A newly created sandbox, with its record as of creation. |
|
Value of an environment variable in a sandbox. |
|
Expires a sandbox at a fixed time. |
|
Expires a sandbox after a period without activity. |
|
Expires a sandbox a period after its creation, regardless of activity. |
|
An expiration policy of a kind this SDK does not know. |
|
Files and directories in a sandbox. |
|
A directory's contents, one level deep, from |
|
A file in a |
|
An entry found by |
|
Result of |
|
A matching line found by |
|
Result of |
|
Filesystem configuration of a sandbox, fixed at creation. |
|
A subdirectory in a |
|
A change seen by |
|
A sandbox as last reported by the control plane. |
|
When a sandbox is deleted automatically, and how long its record stays after. |
|
Network configuration of a sandbox, fixed at creation. |
|
Proxy configuration of a sandbox's network. |
|
A proxy rule injecting headers and body fields into requests to its destinations. |
|
A port the sandbox exposes. |
|
A preview as last reported by the control plane. |
|
An access token for a private preview. |
|
A sandbox's previews, which expose its ports on HTTPS URLs. |
|
Processes in a sandbox. |
|
The exit of the process run by |
|
Output from |
|
A process in a sandbox. |
|
One line of a process's output. |
|
Output of a process, as returned by |
|
Retry budgets for transient failures. |
|
Items a sandbox sends as they happen, read by iterating. |
|
What a token provider is told about the token it is asked for. |
Functions
|
Report whether a path is left out of a pushed build context by default. |