Skip to content

An open-source, faster Devin alternative

TypeScript

python sdk 1.2.0: final deprecation release (097 step 7.2, U1)

Mohamed Habib via Computer1fa3cfe8b261
diff --git a/sdks/python/README.md b/sdks/python/README.md
index ae2eaad4..3ddb03ce 100644
--- a/sdks/python/README.md
+++ b/sdks/python/README.md
@@ -1,5 +1,9 @@
# opencomputer
+> **Deprecated.** `opencomputer-sdk` 1.2.0 is the final release; the package receives no further updates. It is a client for the OpenComputer sandbox platform, which is shut down. Importing `opencomputer` emits a `DeprecationWarning`.
+>
+> There is no Python replacement. For [Serverless Agents](https://opencomputer.dev/agents) call the [management API](https://opencomputer.dev/agents/api) over HTTP, or use the TypeScript client `@opencomputer/sdk/agents` (`npm install @opencomputer/sdk`). Pinning `opencomputer-sdk<1.2` avoids the warning.
+
Python SDK for [OpenComputer](https://github.com/diggerhq/opensandbox) — cloud sandbox platform.
## Install
diff --git a/sdks/python/opencomputer/__init__.py b/sdks/python/opencomputer/__init__.py
index 3b96e9f5..464c2685 100644
--- a/sdks/python/opencomputer/__init__.py
+++ b/sdks/python/opencomputer/__init__.py
@@ -1,4 +1,17 @@
-"""OpenComputer Python SDK - cloud sandbox platform."""
+"""OpenComputer Python SDK - cloud sandbox platform. Deprecated: 1.2.0 is the final release."""
+
+import warnings as _warnings
+
+#: Shown once per process, on the first ``import opencomputer``. A
+#: DeprecationWarning is displayed by default when the importing code is
+#: ``__main__`` and under pytest; elsewhere ``python -W default`` shows it.
+DEPRECATION_MESSAGE = (
+ "opencomputer-sdk is deprecated and receives no further releases: the "
+ "OpenComputer sandbox platform it targets is shut down. For Serverless "
+ "Agents use the management API (https://opencomputer.dev/agents/api) or "
+ "the TypeScript client @opencomputer/sdk/agents (npm install @opencomputer/sdk)."
+)
+_warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=2)
from opencomputer.sandbox import Sandbox, ScalingLockedError, PlanLimitError, SandboxFamilyLimitError
from opencomputer.browser import Browser, BrowserProfile
diff --git a/sdks/python/opencomputer/version.py b/sdks/python/opencomputer/version.py
index 5af1b28d..dcb28d1b 100644
--- a/sdks/python/opencomputer/version.py
+++ b/sdks/python/opencomputer/version.py
@@ -26,7 +26,7 @@ this docstring start with that name: two readers of this file are greps.
from __future__ import annotations
-__version__ = "1.1.0"
+__version__ = "1.2.0"
#: Header carrying the version above. Lower-case to match the TypeScript SDK;
#: HTTP/2 requires it there and consistency costs nothing here.
diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml
index 3ae2acab..c5b0195f 100644
--- a/sdks/python/pyproject.toml
+++ b/sdks/python/pyproject.toml
@@ -8,7 +8,7 @@ name = "opencomputer-sdk"
# server in x-oc-sdk-version. One source, so the published version and the
# routed-on version cannot disagree.
dynamic = ["version"]
-description = "Python SDK for OpenComputer - cloud sandbox platform"
+description = "Deprecated: Python SDK for the retired OpenComputer sandbox platform. 1.2.0 is the final release."
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
@@ -17,7 +17,7 @@ authors = [
]
keywords = ["sandbox", "opencomputer", "cloud", "containers", "code-execution"]
classifiers = [
- "Development Status :: 3 - Alpha",
+ "Development Status :: 7 - Inactive",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
diff --git a/sdks/python/tests/test_deprecation.py b/sdks/python/tests/test_deprecation.py
new file mode 100644
index 00000000..94c89f52
--- /dev/null
+++ b/sdks/python/tests/test_deprecation.py
@@ -0,0 +1,37 @@
+import importlib
+import sys
+import warnings
+
+import pytest
+
+
+def _fresh_import():
+ for name in [m for m in sys.modules if m == "opencomputer" or m.startswith("opencomputer.")]:
+ del sys.modules[name]
+ return importlib.import_module("opencomputer")
+
+
+def test_import_warns_deprecated_and_points_to_replacement():
+ with pytest.warns(DeprecationWarning, match="deprecated") as record:
+ mod = _fresh_import()
+ message = str(record[0].message)
+ assert "@opencomputer/sdk/agents" in message
+ assert "https://opencomputer.dev/agents/api" in message
+ assert mod.DEPRECATION_MESSAGE == message
+
+
+def test_final_release_version_stays_on_major_1():
+ # The server routes on the SDK's major (x-oc-sdk-version); the deprecation
+ # release must not move callers.
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ mod = _fresh_import()
+ assert mod.__version__ == "1.2.0"
+
+
+def test_existing_exports_still_import():
+ with warnings.catch_warnings():
+ warnings.simplefilter("ignore", DeprecationWarning)
+ mod = _fresh_import()
+ for name in mod.__all__:
+ assert hasattr(mod, name), name