Skip to content

An open-source, faster Devin alternative

TypeScript

python sdk: deprecation notice is a FutureWarning so end users see it

Mohamed Habib via Computer45edddfb0baf
diff --git a/sdks/python/README.md b/sdks/python/README.md
index 3ddb03ce..80f3d71f 100644
--- a/sdks/python/README.md
+++ b/sdks/python/README.md
@@ -1,6 +1,6 @@
# 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`.
+> **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 `FutureWarning`.
>
> 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.
diff --git a/sdks/python/opencomputer/__init__.py b/sdks/python/opencomputer/__init__.py
index 464c2685..0e3a4beb 100644
--- a/sdks/python/opencomputer/__init__.py
+++ b/sdks/python/opencomputer/__init__.py
@@ -3,15 +3,15 @@
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.
+#: FutureWarning, not a DeprecationWarning: Python's default filters show it
+#: to end users wherever the import happens, not only in ``__main__``.
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)
+_warnings.warn(DEPRECATION_MESSAGE, FutureWarning, stacklevel=2)
from opencomputer.sandbox import Sandbox, ScalingLockedError, PlanLimitError, SandboxFamilyLimitError
from opencomputer.browser import Browser, BrowserProfile
diff --git a/sdks/python/tests/test_deprecation.py b/sdks/python/tests/test_deprecation.py
index 94c89f52..98c73eac 100644
--- a/sdks/python/tests/test_deprecation.py
+++ b/sdks/python/tests/test_deprecation.py
@@ -12,7 +12,7 @@ def _fresh_import():
def test_import_warns_deprecated_and_points_to_replacement():
- with pytest.warns(DeprecationWarning, match="deprecated") as record:
+ with pytest.warns(FutureWarning, match="deprecated") as record:
mod = _fresh_import()
message = str(record[0].message)
assert "@opencomputer/sdk/agents" in message
@@ -24,14 +24,14 @@ 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)
+ warnings.simplefilter("ignore", FutureWarning)
mod = _fresh_import()
assert mod.__version__ == "1.2.0"
def test_existing_exports_still_import():
with warnings.catch_warnings():
- warnings.simplefilter("ignore", DeprecationWarning)
+ warnings.simplefilter("ignore", FutureWarning)
mod = _fresh_import()
for name in mod.__all__:
assert hasattr(mod, name), name