opencomputer-sdk 0.6.8__tar.gz → 1.0.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.
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/.gitignore +16 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/PKG-INFO +2 -2
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/__init__.py +3 -1
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/browser.py +1 -1
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/project.py +3 -1
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/sandbox.py +5 -1
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/snapshot.py +6 -1
- opencomputer_sdk-1.0.0/opencomputer/version.py +38 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/pyproject.toml +7 -1
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/README.md +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/run_all_tests.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/stream_demo.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_commands.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_concurrent.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_declarative_images.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_default_template.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_disk_size.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_domain_tls.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_environment.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_exec.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_file_ops.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_large_files.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_multi_template.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_python_sdk.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_reconnect.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_secret_store_fork.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_secretstore.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_shell.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/examples/test_timeout.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/agent.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/commands.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/exec.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/filesystem.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/image.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/mounts.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/pty.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/shell.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/sse.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/template.py +0 -0
- {opencomputer_sdk-0.6.8 → opencomputer_sdk-1.0.0}/opencomputer/usage.py +0 -0
|
@@ -81,3 +81,19 @@ deploy/azure/.dev-vector-token-*
|
|
|
81
81
|
/server
|
|
82
82
|
/seed-dev-secrets
|
|
83
83
|
/backfill
|
|
84
|
+
|
|
85
|
+
# Claude Code agent memory (session-local, not source)
|
|
86
|
+
/memory/
|
|
87
|
+
|
|
88
|
+
# Per-env wrangler config generated for CI deploys (not source)
|
|
89
|
+
cloudflare-workers/api-edge/wrangler.ci.toml
|
|
90
|
+
|
|
91
|
+
# Wrangler local build/cache/state (never source)
|
|
92
|
+
.wrangler/
|
|
93
|
+
|
|
94
|
+
# stray binaries from `go build ./cmd/...` without -o
|
|
95
|
+
/microvm-hooks
|
|
96
|
+
/microvm-harness
|
|
97
|
+
|
|
98
|
+
.dev.vars*
|
|
99
|
+
!.dev.vars.example
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: opencomputer-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
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
|
|
@@ -68,4 +68,6 @@ __all__ = [
|
|
|
68
68
|
"TagKeyInfo",
|
|
69
69
|
]
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
# Single source of truth — pyproject.toml reads the same file, so the published
|
|
72
|
+
# version and the version the SDK announces to the server cannot disagree.
|
|
73
|
+
from opencomputer.version import __version__ # noqa: E402,F401
|
|
@@ -58,7 +58,7 @@ class Browser:
|
|
|
58
58
|
kiosk_mode: bool | None = None,
|
|
59
59
|
start_url: str | None = None,
|
|
60
60
|
chrome_policy: dict[str, Any] | None = None,
|
|
61
|
-
telemetry: dict[str, Any] | None = None,
|
|
61
|
+
telemetry: bool | dict[str, Any] | None = None,
|
|
62
62
|
recording: bool | None = None,
|
|
63
63
|
) -> Browser:
|
|
64
64
|
"""Create a browser session and return direct connection URLs."""
|
|
@@ -7,6 +7,8 @@ from typing import Any
|
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
+
from opencomputer.version import sdk_version_headers
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
def _get_client(
|
|
12
14
|
api_key: str | None = None,
|
|
@@ -18,7 +20,7 @@ def _get_client(
|
|
|
18
20
|
|
|
19
21
|
api_base = url if url.endswith("/api") else f"{url}/api"
|
|
20
22
|
|
|
21
|
-
headers: dict[str, str] =
|
|
23
|
+
headers: dict[str, str] = dict(sdk_version_headers())
|
|
22
24
|
if key:
|
|
23
25
|
headers["X-API-Key"] = key
|
|
24
26
|
|
|
@@ -15,6 +15,7 @@ from opencomputer.image import Image
|
|
|
15
15
|
from opencomputer.mounts import Mounts
|
|
16
16
|
from opencomputer.pty import Pty
|
|
17
17
|
from opencomputer.sse import parse_sse_stream
|
|
18
|
+
from opencomputer.version import sdk_version_headers
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class ScalingLockedError(Exception):
|
|
@@ -149,7 +150,10 @@ class Sandbox:
|
|
|
149
150
|
# Control plane client always uses /api prefix
|
|
150
151
|
api_base = url if url.endswith("/api") else f"{url}/api"
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
# Which runtime serves this create. See version.py: an org that has not
|
|
154
|
+
# been pinned is routed by the calling SDK's major version, so upgrading
|
|
155
|
+
# this package is how a customer migrates.
|
|
156
|
+
headers: dict[str, str] = dict(sdk_version_headers())
|
|
153
157
|
if key:
|
|
154
158
|
headers["X-API-Key"] = key
|
|
155
159
|
|
|
@@ -9,6 +9,7 @@ import httpx
|
|
|
9
9
|
|
|
10
10
|
from opencomputer.image import Image
|
|
11
11
|
from opencomputer.sse import parse_sse_stream
|
|
12
|
+
from opencomputer.version import sdk_version_headers
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class Snapshots:
|
|
@@ -41,7 +42,11 @@ class Snapshots:
|
|
|
41
42
|
|
|
42
43
|
api_base = url if url.endswith("/api") else f"{url}/api"
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
# A template is built differently per runtime — a whole-disk checkpoint on
|
|
46
|
+
# one, a machine image on the other — so the same version header the
|
|
47
|
+
# create path sends has to ride along here, or a caller would build a
|
|
48
|
+
# template their sandboxes cannot use. See version.py.
|
|
49
|
+
self._headers: dict[str, str] = dict(sdk_version_headers())
|
|
45
50
|
if key:
|
|
46
51
|
self._headers["X-API-Key"] = key
|
|
47
52
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""The SDK's own identity, sent on the requests that decide which runtime serves
|
|
2
|
+
a customer: creating a sandbox and creating a template or snapshot.
|
|
3
|
+
|
|
4
|
+
This is what makes self-service migration possible. An org that has not been
|
|
5
|
+
pinned to a runtime lands on the MicroVM backend when it calls with a 1.x SDK
|
|
6
|
+
and on the QEMU fleet when it calls with an older one — so upgrading the
|
|
7
|
+
dependency IS the migration, and pinning the old version is the rollback.
|
|
8
|
+
Nothing has to change in our database for either direction.
|
|
9
|
+
|
|
10
|
+
Only the MAJOR is load-bearing: the server compares it against a minimum, so
|
|
11
|
+
patch and minor releases never move anyone.
|
|
12
|
+
|
|
13
|
+
1.0.0, not 2.0.0, even though the docs call this platform generation "v2": every
|
|
14
|
+
version this package has ever published is 0.x, so 1.0.0 is both the first
|
|
15
|
+
stable release and a clean major break from all of them. The product generation
|
|
16
|
+
and the package major are not the same number.
|
|
17
|
+
|
|
18
|
+
This file is the single source of truth for the version: pyproject.toml declares
|
|
19
|
+
it dynamic and hatch's version hook reads the assignment below, and CI reads the
|
|
20
|
+
same line to decide whether to publish. That is deliberate — a constant that
|
|
21
|
+
drifted from the published version would ship a release still announcing the old
|
|
22
|
+
one, leaving every customer who upgraded on the old runtime with no error
|
|
23
|
+
anywhere. Keep the assignment on one line, at column 0, and do not let prose in
|
|
24
|
+
this docstring start with that name: two readers of this file are greps.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
__version__ = "1.0.0"
|
|
30
|
+
|
|
31
|
+
#: Header carrying the version above. Lower-case to match the TypeScript SDK;
|
|
32
|
+
#: HTTP/2 requires it there and consistency costs nothing here.
|
|
33
|
+
SDK_VERSION_HEADER = "x-oc-sdk-version"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def sdk_version_headers() -> dict[str, str]:
|
|
37
|
+
"""The identifying header, ready to merge into a request's headers."""
|
|
38
|
+
return {SDK_VERSION_HEADER: __version__}
|
|
@@ -4,7 +4,10 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "opencomputer-sdk"
|
|
7
|
-
version
|
|
7
|
+
# Read from opencomputer/version.py, which is also what the SDK announces to the
|
|
8
|
+
# server in x-oc-sdk-version. One source, so the published version and the
|
|
9
|
+
# routed-on version cannot disagree.
|
|
10
|
+
dynamic = ["version"]
|
|
8
11
|
description = "Python SDK for OpenComputer - cloud sandbox platform"
|
|
9
12
|
readme = "README.md"
|
|
10
13
|
requires-python = ">=3.10"
|
|
@@ -41,6 +44,9 @@ Repository = "https://github.com/diggerhq/opensandbox"
|
|
|
41
44
|
Documentation = "https://github.com/diggerhq/opensandbox/tree/main/sdks/python"
|
|
42
45
|
Issues = "https://github.com/diggerhq/opensandbox/issues"
|
|
43
46
|
|
|
47
|
+
[tool.hatch.version]
|
|
48
|
+
path = "opencomputer/version.py"
|
|
49
|
+
|
|
44
50
|
[tool.hatch.build.targets.wheel]
|
|
45
51
|
packages = ["opencomputer"]
|
|
46
52
|
exclude = ["__pycache__"]
|
|
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
|
|
File without changes
|
|
File without changes
|