Skip to main content

Python SDK for the Brimble Sandbox API

Project description

brimble-sandbox

Python SDK for the Brimble Sandbox API.

Install

pip install brimble-sandbox

Quickstart

from brimble_sandbox import SandboxClient

client = SandboxClient()  # reads BRIMBLE_SANDBOX_KEY from env

sandbox = client.sandboxes.create_ready(
    {
        "template": "node-22",
        "persistent": True,
        "persistentDiskGB": 20,
    }
)

result = sandbox.exec({"cmd": "node -v"})
print(result["stdout"])

existing = client.sandboxes.get(sandbox.id)
existing.destroy()

Ergonomic helpers

# Create + wait in one call
created = client.sandboxes.create_ready({"template": "node-22"})

# Get + wait in one call
loaded = client.sandboxes.get_ready(created.id)

# Create volume + attach at sandbox creation time
with_volume = client.sandboxes.with_volume(
    {
        "sandbox": {"template": "node-22"},
        "volume": {"name": "workspace-disk", "sizeGB": 20},
    }
)

# Auto-wait on runtime calls
with_volume.exec({"cmd": "npm -v"}, wait_until_ready=True)

# Streaming SSE output
stream = with_volume.exec_stream({"cmd": "for i in 1 2 3; do echo $i; done"})

# Templates + regions
templates = client.sandboxes.list_templates()
node_template = client.sandboxes.get_template("node-22")
regions = client.sandboxes.list_regions()

# Iterate through all sandboxes
for sb in client.sandboxes.iterate({"teamId": "<team>"}):
    print(sb.id, sb.status)

Volume attachment is create-time only. Use create(..., volumeId=...) or with_volume(...).

Auth

Requests are authenticated with the x-brimble-key header.

  • Pass api_key to SandboxClient(...)
  • Or set BRIMBLE_SANDBOX_KEY in your environment

Retry, timeout, idempotency

from brimble_sandbox import RetryOptions, SandboxClient

client = SandboxClient(
    retry=RetryOptions(max_attempts=3, base_delay_ms=250, max_delay_ms=2000),
)

sandbox = client.sandboxes.create(
    {"template": "node-22"},
    idempotency_key="create-sandbox-123",
)

If region is omitted, the SDK resolves the first available sandbox region automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brimble_sandbox-0.1.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brimble_sandbox-0.1.0-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file brimble_sandbox-0.1.0.tar.gz.

File metadata

  • Download URL: brimble_sandbox-0.1.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for brimble_sandbox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 892a449a5b74d64867634521747b74adfa1edc200d743eba5610c47a19466c29
MD5 dd0e4eca146ce877e5ad35ee80613af0
BLAKE2b-256 2d14d0be6aa1aad3c6bac992fee5b68ef15aac07379e88d662d3817979f3e5b4

See more details on using hashes here.

File details

Details for the file brimble_sandbox-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brimble_sandbox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcbfcb6b95effb8bf3ac119bd969786654e756c9188e979753d59c6004cec2f4
MD5 1bf1e7ae3fa812b043bacb647c7651ca
BLAKE2b-256 3287dbacb97f756a87eab01967d1985540eb228e0e585dc33d2e5da1e0f6dbc1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page