spawnbox-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spawnbox_sdk-0.1.0/PKG-INFO +96 -0
- spawnbox_sdk-0.1.0/README.md +77 -0
- spawnbox_sdk-0.1.0/pyproject.toml +30 -0
- spawnbox_sdk-0.1.0/setup.cfg +4 -0
- spawnbox_sdk-0.1.0/src/spawnbox/__init__.py +23 -0
- spawnbox_sdk-0.1.0/src/spawnbox/client.py +980 -0
- spawnbox_sdk-0.1.0/src/spawnbox_sdk.egg-info/PKG-INFO +96 -0
- spawnbox_sdk-0.1.0/src/spawnbox_sdk.egg-info/SOURCES.txt +9 -0
- spawnbox_sdk-0.1.0/src/spawnbox_sdk.egg-info/dependency_links.txt +1 -0
- spawnbox_sdk-0.1.0/src/spawnbox_sdk.egg-info/top_level.txt +1 -0
- spawnbox_sdk-0.1.0/tests/test_client.py +182 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spawnbox-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the self-hosted Spawnbox microVM sandbox runtime
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://spawnbox.tulipfarm.ai
|
|
7
|
+
Project-URL: Repository, https://github.com/TulipFarm/spawnbox
|
|
8
|
+
Project-URL: Issues, https://github.com/TulipFarm/spawnbox/issues
|
|
9
|
+
Keywords: spawnbox,sandbox,microvm,firecracker,ai-agents,sdk
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# spawnbox-sdk
|
|
21
|
+
|
|
22
|
+
Official zero-dependency Python SDK (sync and `asyncio`) for the self-hosted [Spawnbox](https://github.com/TulipFarm/spawnbox) microVM sandbox runtime.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
pip install spawnbox-sdk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
or with `uv`:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
uv add spawnbox-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Requires Python `>= 3.10`. Zero external runtime dependencies.
|
|
37
|
+
|
|
38
|
+
## Quickstart (Sync)
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import os
|
|
42
|
+
from spawnbox import SpawnboxClient
|
|
43
|
+
|
|
44
|
+
client = SpawnboxClient(
|
|
45
|
+
os.environ.get("SPAWNBOX_URL", "http://127.0.0.1:8080"),
|
|
46
|
+
os.environ.get("SPAWNBOX_API_KEY", ""),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
with client.create_sandbox("python-3.12") as sb:
|
|
50
|
+
res = sb.exec("python3 -c 'print(6 * 7)'", no_new_privs=True)
|
|
51
|
+
print(res["stdout"])
|
|
52
|
+
|
|
53
|
+
for event in sb.exec_stream("for i in 1 2 3; do echo $i; done"):
|
|
54
|
+
print(event["event"], event["data"])
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quickstart (Async)
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import asyncio
|
|
61
|
+
import os
|
|
62
|
+
from spawnbox import AsyncSpawnboxClient
|
|
63
|
+
|
|
64
|
+
async def main() -> None:
|
|
65
|
+
client = AsyncSpawnboxClient(
|
|
66
|
+
os.environ.get("SPAWNBOX_URL", "http://127.0.0.1:8080"),
|
|
67
|
+
os.environ.get("SPAWNBOX_API_KEY", ""),
|
|
68
|
+
)
|
|
69
|
+
async with await client.create_sandbox("code-interpreter") as sb:
|
|
70
|
+
run = await sb.code_interpreter().run_code("x = 41\nprint(x + 1)")
|
|
71
|
+
print(run["stdout"])
|
|
72
|
+
|
|
73
|
+
asyncio.run(main())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Browser Helper
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
with client.create_sandbox("browser-computer-use") as sb:
|
|
80
|
+
browser = sb.browser()
|
|
81
|
+
live = browser.live_view_url(access="token")
|
|
82
|
+
shot = browser.screenshot()
|
|
83
|
+
browser.click(640, 360)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## API Coverage
|
|
87
|
+
|
|
88
|
+
- **Sandboxes**: `create_sandbox`, `get_sandbox`, `list_sandboxes`, `delete_sandbox`, `fork`, `snapshot`, `pause`, `resume`, `events`
|
|
89
|
+
- **Execution**: `exec` (JSON, stdin, `no_new_privs`), `exec_stream` (SSE iterator / async iterator)
|
|
90
|
+
- **Files & Archives**: `read_file`, `read_text_file`, `write_file`, `list_files`, `delete_file`, `upload_archive`, `download_archive` (`tar.zst`)
|
|
91
|
+
- **Ports, Services & Git**: `publish_port`, `list_ports`, `unpublish_port`, `port_ready`, `list_services`, `restart_service`, `service_logs`, `git_clone`
|
|
92
|
+
- **Volumes, Templates & Secrets**: `create_volume`, `list_volumes`, `get_volume`, `delete_volume`, `list_templates`, `get_template`, `put_template`, `delete_template`, `list_secrets`, `upsert_secret`, `delete_secret`
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
[Apache-2.0](https://github.com/TulipFarm/spawnbox/blob/main/LICENSE)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# spawnbox-sdk
|
|
2
|
+
|
|
3
|
+
Official zero-dependency Python SDK (sync and `asyncio`) for the self-hosted [Spawnbox](https://github.com/TulipFarm/spawnbox) microVM sandbox runtime.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pip install spawnbox-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or with `uv`:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
uv add spawnbox-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires Python `>= 3.10`. Zero external runtime dependencies.
|
|
18
|
+
|
|
19
|
+
## Quickstart (Sync)
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
import os
|
|
23
|
+
from spawnbox import SpawnboxClient
|
|
24
|
+
|
|
25
|
+
client = SpawnboxClient(
|
|
26
|
+
os.environ.get("SPAWNBOX_URL", "http://127.0.0.1:8080"),
|
|
27
|
+
os.environ.get("SPAWNBOX_API_KEY", ""),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
with client.create_sandbox("python-3.12") as sb:
|
|
31
|
+
res = sb.exec("python3 -c 'print(6 * 7)'", no_new_privs=True)
|
|
32
|
+
print(res["stdout"])
|
|
33
|
+
|
|
34
|
+
for event in sb.exec_stream("for i in 1 2 3; do echo $i; done"):
|
|
35
|
+
print(event["event"], event["data"])
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quickstart (Async)
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
import os
|
|
43
|
+
from spawnbox import AsyncSpawnboxClient
|
|
44
|
+
|
|
45
|
+
async def main() -> None:
|
|
46
|
+
client = AsyncSpawnboxClient(
|
|
47
|
+
os.environ.get("SPAWNBOX_URL", "http://127.0.0.1:8080"),
|
|
48
|
+
os.environ.get("SPAWNBOX_API_KEY", ""),
|
|
49
|
+
)
|
|
50
|
+
async with await client.create_sandbox("code-interpreter") as sb:
|
|
51
|
+
run = await sb.code_interpreter().run_code("x = 41\nprint(x + 1)")
|
|
52
|
+
print(run["stdout"])
|
|
53
|
+
|
|
54
|
+
asyncio.run(main())
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Browser Helper
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
with client.create_sandbox("browser-computer-use") as sb:
|
|
61
|
+
browser = sb.browser()
|
|
62
|
+
live = browser.live_view_url(access="token")
|
|
63
|
+
shot = browser.screenshot()
|
|
64
|
+
browser.click(640, 360)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API Coverage
|
|
68
|
+
|
|
69
|
+
- **Sandboxes**: `create_sandbox`, `get_sandbox`, `list_sandboxes`, `delete_sandbox`, `fork`, `snapshot`, `pause`, `resume`, `events`
|
|
70
|
+
- **Execution**: `exec` (JSON, stdin, `no_new_privs`), `exec_stream` (SSE iterator / async iterator)
|
|
71
|
+
- **Files & Archives**: `read_file`, `read_text_file`, `write_file`, `list_files`, `delete_file`, `upload_archive`, `download_archive` (`tar.zst`)
|
|
72
|
+
- **Ports, Services & Git**: `publish_port`, `list_ports`, `unpublish_port`, `port_ready`, `list_services`, `restart_service`, `service_logs`, `git_clone`
|
|
73
|
+
- **Volumes, Templates & Secrets**: `create_volume`, `list_volumes`, `get_volume`, `delete_volume`, `list_templates`, `get_template`, `put_template`, `delete_template`, `list_secrets`, `upsert_secret`, `delete_secret`
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
[Apache-2.0](https://github.com/TulipFarm/spawnbox/blob/main/LICENSE)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "spawnbox-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official Python SDK for the self-hosted Spawnbox microVM sandbox runtime"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = []
|
|
13
|
+
keywords = ["spawnbox", "sandbox", "microvm", "firecracker", "ai-agents", "sdk"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://spawnbox.tulipfarm.ai"
|
|
26
|
+
Repository = "https://github.com/TulipFarm/spawnbox"
|
|
27
|
+
Issues = "https://github.com/TulipFarm/spawnbox/issues"
|
|
28
|
+
|
|
29
|
+
[tool.setuptools.packages.find]
|
|
30
|
+
where = ["src"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from .client import (
|
|
2
|
+
AsyncCodeInterpreter,
|
|
3
|
+
AsyncSandbox,
|
|
4
|
+
AsyncSandboxBrowser,
|
|
5
|
+
AsyncSpawnboxClient,
|
|
6
|
+
CodeInterpreter,
|
|
7
|
+
Sandbox,
|
|
8
|
+
SandboxBrowser,
|
|
9
|
+
SpawnboxClient,
|
|
10
|
+
SpawnboxError,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"AsyncCodeInterpreter",
|
|
15
|
+
"AsyncSandbox",
|
|
16
|
+
"AsyncSandboxBrowser",
|
|
17
|
+
"AsyncSpawnboxClient",
|
|
18
|
+
"CodeInterpreter",
|
|
19
|
+
"Sandbox",
|
|
20
|
+
"SandboxBrowser",
|
|
21
|
+
"SpawnboxClient",
|
|
22
|
+
"SpawnboxError",
|
|
23
|
+
]
|