DSB Python SDK
Python SDK for interacting with Distributed Sandboxes (DSB), including sandbox management, SSH sessions, terminals, and web automation.
Installation
pip install dsb-sdk
Initialization
The SDK provides both synchronous and asynchronous clients. Always use context managers (with or async with) to ensure proper resource cleanup.
from dsb_sdk import DSBClient, AsyncDSBClient
# Synchronous client
with DSBClient(api_url="http://localhost:8080/api") as client:
pass # Use the client
# Asynchronous client
async with AsyncDSBClient(api_url="http://localhost:8080/api") as async_client:
pass # Use the async client
Quickstart: Sandbox Management
Create, check, and delete a sandbox easily.
from dsb_sdk import DSBClient
with DSBClient(api_url="http://localhost:8080/api") as client:
# Create a sandbox
sandbox = client.sandbox.create(image="python:3.12", name="my-sandbox")
print(f"Created sandbox: {sandbox.id}")
# Check status
status = client.sandbox.get(sandbox.id)
print(f"Sandbox status: {status.state}")
# Delete the sandbox
client.sandbox.delete(sandbox.id)
print("Sandbox deleted")
Executing Code
Run commands directly inside a running sandbox.
from dsb_sdk import DSBClient
from dsb_sdk.types.exec import ExecRequest
with DSBClient(api_url="http://localhost:8080/api") as client:
sandbox = client.sandbox.create(image="python:3.12")
# Execute a command
request = ExecRequest(cmd=["echo", "Hello from DSB!"])
response = client.sandbox.exec(sandbox.id, request)
print(response.stdout)
client.sandbox.delete(sandbox.id)
Other Features
SSH Access
Retrieve SSH connection details for a sandbox.
with DSBClient(api_url="http://localhost:8080/api") as client:
ssh_session = client.ssh.create_session(sandbox.id)
print(f"Connect via: ssh -p {ssh_session.port} {ssh_session.user}@{ssh_session.host}")
Web Automation
Scrape a webpage.
with DSBClient(api_url="http://localhost:8080/api") as client:
result = client.web.scrape("https://example.com")
print(result.markdown)
Async Support
All synchronous methods have an asynchronous equivalent when using AsyncDSBClient. Simply append _async to the method name.
async with AsyncDSBClient(api_url="http://localhost:8080/api") as client:
sandbox = await client.sandbox.create_async(image="python:3.12")
await client.sandbox.delete_async(sandbox.id)
Metadata
Release files for dsb-sdk 0.10.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dsb_sdk-0.10.8.tar.gz | 121.7 kB | Without provenance | Details for dsb_sdk-0.10.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dsb_sdk-0.10.8-py3-none-any.whl | Python 3 | none | any | Details for dsb_sdk-0.10.8-py3-none-any.whl |
Total release size: 211.0 kB
Release files / dsb_sdk-0.10.8.tar.gz
| Download URL | dsb_sdk-0.10.8.tar.gz |
|---|---|
| Size | 121.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d72428522cbe4ec58cba06914ea8aabedecebb2ec5b6b4a93aa1a6b77aacee7
|
|
BLAKE2b-256 checksum How to use checksums |
6d4114b47bb5a22c7166bba53c6c26462aa15a776726fbf2d0e4587a2f200399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dsb_sdk-0.10.8-py3-none-any.whl
| Download URL | dsb_sdk-0.10.8-py3-none-any.whl |
|---|---|
| Size | 89.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
072c56f64b0d6852c8b9bd7074d01739c6ce885a5e420bc010d49701af0cb0c8
|
|
BLAKE2b-256 checksum How to use checksums |
f13df3f5d4c5cccd13b3f24c6b87e26863afad9354980e25c70233678b708a04
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for dsb-sdk 0.10.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.