Sandbox0 Python SDK
Project description
Sandbox0 Python SDK
The official Python SDK for Sandbox0, providing typed models and ergonomic high-level APIs for managing secure code execution sandboxes.
Installation
pip install sandbox0
Requirements
- Python 3.9 or later
Configuration
| Environment Variable | Required | Default | Description |
|---|---|---|---|
SANDBOX0_TOKEN |
Yes | - | API authentication token |
SANDBOX0_BASE_URL |
No | https://api.sandbox0.ai |
API base URL |
Quick Start
import os
from sandbox0 import Client
client = Client(token=os.environ["SANDBOX0_TOKEN"])
# Using context manager for automatic cleanup
with client.sandboxes.open("default") as sandbox:
# Execute Python code (REPL - stateful)
result = sandbox.run("python", "print('Hello, Sandbox0!')")
print(result.output_raw, end="")
Examples
Runnable examples are available in the examples/ directory:
| Example | Description |
|---|---|
01_hello_world |
Basic sandbox usage |
02_context_options |
Context configuration options |
03_files |
File read/write/list operations |
04_streaming |
Streaming execution output |
05_templates |
Working with sandbox templates |
06_volumes |
Persistent volumes and snapshots |
07_webhook |
Webhook event delivery |
08_network |
Network policy configuration |
09_expose_port |
Exposing ports publicly |
Run an example:
cd examples/01_hello_world
SANDBOX0_TOKEN=your-token python main.py
Links
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sandbox0-0.2.1.tar.gz
(128.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sandbox0-0.2.1-py3-none-any.whl
(432.6 kB
view details)
File details
Details for the file sandbox0-0.2.1.tar.gz.
File metadata
- Download URL: sandbox0-0.2.1.tar.gz
- Upload date:
- Size: 128.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d55df998c58d03b17b50ec6138e02b0471334d5eb910702126767509992ef2f
|
|
| MD5 |
4b1666d6b31c49f66ede026fb733ff03
|
|
| BLAKE2b-256 |
fed5b4f4add18ee4b20171ddfae4d897fb68447c6f81062530e36cd77a8431e7
|
File details
Details for the file sandbox0-0.2.1-py3-none-any.whl.
File metadata
- Download URL: sandbox0-0.2.1-py3-none-any.whl
- Upload date:
- Size: 432.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
772ed1180a4b2e3788ee9059d5945c0ad02627e935cb40cf44817d8fece08cda
|
|
| MD5 |
378454feea779f7da5631e7699a85221
|
|
| BLAKE2b-256 |
ada35bde4de82a41fd8766760a694765418d385056ce182241bd1e409f90e1a7
|