opencomputer-sdk 0.5.2__tar.gz → 0.5.3__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.
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/PKG-INFO +1 -1
- opencomputer_sdk-0.5.3/examples/test_disk_size.py +102 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/sandbox.py +8 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/pyproject.toml +1 -1
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/.gitignore +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/README.md +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/run_all_tests.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_commands.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_concurrent.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_declarative_images.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_default_template.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_domain_tls.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_environment.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_exec.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_file_ops.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_large_files.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_multi_template.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_python_sdk.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_reconnect.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_secret_store_fork.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_secretstore.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/examples/test_timeout.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/__init__.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/agent.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/commands.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/exec.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/filesystem.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/image.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/project.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/pty.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/snapshot.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/sse.py +0 -0
- {opencomputer_sdk-0.5.2 → opencomputer_sdk-0.5.3}/opencomputer/template.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opencomputer-sdk
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: Python SDK for OpenComputer - cloud sandbox platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/diggerhq/opensandbox
|
|
6
6
|
Project-URL: Repository, https://github.com/diggerhq/opensandbox
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Disk Size Test
|
|
4
|
+
|
|
5
|
+
Verifies the `disk_mb` sandbox creation parameter:
|
|
6
|
+
1. Default (no arg) → 20GB workspace
|
|
7
|
+
2. Explicit 20GB → 20GB workspace
|
|
8
|
+
3. Explicit 30GB → 30GB workspace (requires org `max_disk_mb` >= 30720)
|
|
9
|
+
4. Below minimum → rejected with 400
|
|
10
|
+
|
|
11
|
+
Larger disk sizes are in closed beta — contact us to raise your org's
|
|
12
|
+
max_disk_mb ceiling: https://cal.com/team/digger/opencomputer-founder-chat
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
python examples/test_disk_size.py
|
|
16
|
+
|
|
17
|
+
Environment:
|
|
18
|
+
OPENCOMPUTER_API_URL (default: http://localhost:8080)
|
|
19
|
+
OPENCOMPUTER_API_KEY (default: test-key)
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import asyncio
|
|
23
|
+
import os
|
|
24
|
+
import sys
|
|
25
|
+
|
|
26
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
|
27
|
+
from opencomputer import Sandbox
|
|
28
|
+
|
|
29
|
+
API_URL = os.environ.get("OPENCOMPUTER_API_URL", "http://localhost:8080")
|
|
30
|
+
API_KEY = os.environ.get("OPENCOMPUTER_API_KEY", "test-key")
|
|
31
|
+
|
|
32
|
+
GREEN = "\033[32m"
|
|
33
|
+
RED = "\033[31m"
|
|
34
|
+
BOLD = "\033[1m"
|
|
35
|
+
DIM = "\033[2m"
|
|
36
|
+
RESET = "\033[0m"
|
|
37
|
+
|
|
38
|
+
passed = 0
|
|
39
|
+
failed = 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def green(msg: str) -> None:
|
|
43
|
+
print(f"{GREEN}✓ {msg}{RESET}")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def red(msg: str) -> None:
|
|
47
|
+
print(f"{RED}✗ {msg}{RESET}")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def bold(msg: str) -> None:
|
|
51
|
+
print(f"{BOLD}{msg}{RESET}")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def dim(msg: str) -> None:
|
|
55
|
+
print(f"{DIM} {msg}{RESET}")
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def run_case(label: str, disk_mb: int | None, expect_size: str | None, expect_reject: bool = False) -> None:
|
|
59
|
+
global passed, failed
|
|
60
|
+
bold(f"\n{label}")
|
|
61
|
+
kwargs = dict(api_url=API_URL, api_key=API_KEY, timeout=120)
|
|
62
|
+
if disk_mb is not None:
|
|
63
|
+
kwargs["disk_mb"] = disk_mb
|
|
64
|
+
try:
|
|
65
|
+
async with await Sandbox.create(**kwargs) as sb:
|
|
66
|
+
dim(f"created {sb.sandbox_id}")
|
|
67
|
+
r = await sb.exec.run("df -h /home/sandbox | tail -1")
|
|
68
|
+
dim(f"df: {r.stdout.strip()}")
|
|
69
|
+
if expect_reject:
|
|
70
|
+
red("expected rejection but sandbox was created")
|
|
71
|
+
failed += 1
|
|
72
|
+
elif expect_size and expect_size in r.stdout:
|
|
73
|
+
green(f"workspace reports {expect_size}")
|
|
74
|
+
passed += 1
|
|
75
|
+
else:
|
|
76
|
+
red(f"expected {expect_size} in df output")
|
|
77
|
+
failed += 1
|
|
78
|
+
except Exception as e:
|
|
79
|
+
if expect_reject:
|
|
80
|
+
green(f"rejected as expected ({str(e).splitlines()[0]})")
|
|
81
|
+
passed += 1
|
|
82
|
+
else:
|
|
83
|
+
red(f"unexpected error: {e}")
|
|
84
|
+
failed += 1
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async def main() -> None:
|
|
88
|
+
bold("OpenComputer SDK — disk size test")
|
|
89
|
+
dim(f"API: {API_URL}")
|
|
90
|
+
|
|
91
|
+
await run_case("default (no disk_mb)", None, "20G")
|
|
92
|
+
await run_case("explicit 20GB", 20480, "20G")
|
|
93
|
+
await run_case("30GB", 30720, "30G")
|
|
94
|
+
await run_case("below minimum (8GB)", 8192, None, expect_reject=True)
|
|
95
|
+
|
|
96
|
+
print()
|
|
97
|
+
bold(f"Results: {passed} passed, {failed} failed")
|
|
98
|
+
sys.exit(1 if failed > 0 else 0)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
if __name__ == "__main__":
|
|
102
|
+
asyncio.run(main())
|
|
@@ -39,6 +39,7 @@ class Sandbox:
|
|
|
39
39
|
api_url: str | None = None,
|
|
40
40
|
envs: dict[str, str] | None = None,
|
|
41
41
|
metadata: dict[str, str] | None = None,
|
|
42
|
+
disk_mb: int | None = None,
|
|
42
43
|
secret_store: str | None = None,
|
|
43
44
|
image: Image | None = None,
|
|
44
45
|
snapshot: str | None = None,
|
|
@@ -53,6 +54,11 @@ class Sandbox:
|
|
|
53
54
|
api_url: API URL (or OPENCOMPUTER_API_URL env var).
|
|
54
55
|
envs: Environment variables to inject. Overrides store secrets.
|
|
55
56
|
metadata: Custom metadata key-value pairs.
|
|
57
|
+
disk_mb: Workspace disk size in MB (default 20480 = 20GB). Any
|
|
58
|
+
additional GB above 20GB is metered at a per-second rate
|
|
59
|
+
comparable to EBS gp3. Closed beta: requests above 20GB
|
|
60
|
+
require the org's ``max_disk_mb`` to be raised. Contact us:
|
|
61
|
+
https://cal.com/team/digger/opencomputer-founder-chat
|
|
56
62
|
secret_store: Secret store name — resolves encrypted secrets
|
|
57
63
|
and egress allowlist.
|
|
58
64
|
image: Declarative Image definition. The server builds and caches it as a checkpoint.
|
|
@@ -88,6 +94,8 @@ class Sandbox:
|
|
|
88
94
|
body["envs"] = envs
|
|
89
95
|
if metadata:
|
|
90
96
|
body["metadata"] = metadata
|
|
97
|
+
if disk_mb is not None:
|
|
98
|
+
body["diskMB"] = disk_mb
|
|
91
99
|
if secret_store:
|
|
92
100
|
body["secretStore"] = secret_store
|
|
93
101
|
if image is not None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|