Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-sandbox): depend on published Fleet facade (#2570)

r33drichards55b69898f057
diff --git a/libs/python/cua-sandbox/README.md b/libs/python/cua-sandbox/README.md
index 093d3ce51b..0a54a313bb 100644
--- a/libs/python/cua-sandbox/README.md
+++ b/libs/python/cua-sandbox/README.md
@@ -6,9 +6,9 @@ Sandboxed VM environments with a unified Python API. Cloud by default.
pip install cua-sandbox
```
-Fleet support requires the platform-specific `cua-train` wheel that bundles the
-`cyclops_sdk` native binding. Install from the Cua wheel index when resolving
-dependencies with pip:
+Fleet support is provided through the `cua-fleet` facade. Its transitive
+`cua-train` dependency bundles the platform-specific `cyclops_sdk` native binding.
+Install from the Cua wheel index when resolving dependencies with pip:
```bash
pip install --extra-index-url https://wheels.cua.ai/simple cua-sandbox
diff --git a/libs/python/cua-sandbox/pyproject.toml b/libs/python/cua-sandbox/pyproject.toml
index 88f5d0e896..5927096ab2 100644
--- a/libs/python/cua-sandbox/pyproject.toml
+++ b/libs/python/cua-sandbox/pyproject.toml
@@ -29,7 +29,7 @@ requires-python = ">=3.11,<3.14"
dependencies = [
"cua-core>=0.3.0,<0.4.0",
"cua-auto>=0.1.2",
- "cua-train==0.1.1",
+ "cua-fleet==0.0.4",
"websockets>=12.0",
"httpx>=0.27.0",
"oras>=0.2.40",
@@ -96,9 +96,7 @@ dev = [
[tool.uv.sources]
cua-agent = { path = "../agent", editable = true }
-cua-train = { index = "cua-wheels" }
[[tool.uv.index]]
name = "cua-wheels"
url = "https://wheels.cua.ai/simple"
-explicit = true
diff --git a/libs/python/cua-sandbox/tests/test_cyclops_sdk_distribution.py b/libs/python/cua-sandbox/tests/test_cyclops_sdk_distribution.py
index d13d3d26e2..ba8212297c 100644
--- a/libs/python/cua-sandbox/tests/test_cyclops_sdk_distribution.py
+++ b/libs/python/cua-sandbox/tests/test_cyclops_sdk_distribution.py
@@ -1,16 +1,23 @@
-from importlib.metadata import distribution
+from importlib.metadata import distribution, requires
from pathlib import Path
+import cua_fleet
+import cua_train
import cyclops_sdk
from cua_sandbox.transport.fleet_cloud import FleetCloudTransport
-def test_cyclops_sdk_is_provided_by_cua_train_distribution():
- cua_train = distribution("cua-train")
- installed_files = {str(path) for path in cua_train.files or []}
- distribution_root = Path(cua_train.locate_file(".")).resolve()
+def test_cyclops_sdk_is_provided_by_published_fleets_transitive_train_distribution():
+ cua_fleet_distribution = distribution("cua-fleet")
+ cua_train_distribution = distribution("cua-train")
+ installed_files = {str(path) for path in cua_train_distribution.files or []}
+ distribution_root = Path(cua_train_distribution.locate_file(".")).resolve()
binding_path = Path(cyclops_sdk.__file__).resolve()
+ assert cua_fleet_distribution.version == "0.0.4"
+ assert "cua-train==0.1.1" in (requires("cua-fleet") or [])
+ assert cua_fleet.TrainClient is cua_train.TrainClient
+ assert cua_fleet.__all__ == ["TrainClient"]
assert "cyclops_sdk/__init__.py" in installed_files
assert binding_path.is_relative_to(distribution_root)
assert FleetCloudTransport.__module__ == "cua_sandbox.transport.fleet_cloud"
diff --git a/libs/python/cua-sandbox/tests/test_cyclops_sdk_packaging.py b/libs/python/cua-sandbox/tests/test_cyclops_sdk_packaging.py
index 4b36f02d35..ef029f30fe 100644
--- a/libs/python/cua-sandbox/tests/test_cyclops_sdk_packaging.py
+++ b/libs/python/cua-sandbox/tests/test_cyclops_sdk_packaging.py
@@ -4,6 +4,7 @@ from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
PYPROJECT_PATH = PROJECT_ROOT / "pyproject.toml"
+LOCK_PATH = PROJECT_ROOT / "uv.lock"
FLEET_IMPORTS = (
PROJECT_ROOT / "cua_sandbox" / "transport" / "cyclops_http_client.py",
PROJECT_ROOT / "cua_sandbox" / "transport" / "fleet.py",
@@ -12,31 +13,63 @@ FLEET_IMPORTS = (
class CyclopsSdkPackagingTests(unittest.TestCase):
- def test_declares_packaged_cyclops_sdk_distribution(self):
+ def test_declares_published_fleet_without_a_direct_train_dependency(self):
with PYPROJECT_PATH.open("rb") as pyproject_file:
project = tomllib.load(pyproject_file)
- self.assertIn("cua-train==0.1.1", project["project"]["dependencies"])
- self.assertEqual(project["tool"]["uv"]["sources"]["cua-train"], {"index": "cua-wheels"})
+ dependencies = project["project"]["dependencies"]
+ self.assertIn("cua-fleet==0.0.4", dependencies)
+ self.assertFalse(any(dependency.startswith("cua-train") for dependency in dependencies))
+ self.assertNotIn("cua-fleet", project["tool"]["uv"]["sources"])
+ self.assertNotIn("cua-train", project["tool"]["uv"]["sources"])
self.assertEqual(
project["tool"]["uv"]["index"][0],
{
"name": "cua-wheels",
"url": "https://wheels.cua.ai/simple",
- "explicit": True,
},
)
+ def test_lock_keeps_train_only_as_a_fleet_transitive_dependency(self):
+ with LOCK_PATH.open("rb") as lock_file:
+ lock = tomllib.load(lock_file)
+
+ packages = {package["name"]: package for package in lock["package"]}
+ sandbox_dependencies = {
+ dependency["name"] for dependency in packages["cua-sandbox"]["dependencies"]
+ }
+ sandbox_requires_dist = {
+ requirement["name"]
+ for requirement in packages["cua-sandbox"]["metadata"]["requires-dist"]
+ }
+ fleet_dependencies = {
+ dependency["name"] for dependency in packages["cua-fleet"]["dependencies"]
+ }
+ self.assertIn("cua-fleet", sandbox_dependencies)
+ self.assertNotIn("cua-train", sandbox_dependencies)
+ self.assertIn("cua-fleet", sandbox_requires_dist)
+ self.assertNotIn("cua-train", sandbox_requires_dist)
+ self.assertEqual(packages["cua-fleet"]["version"], "0.0.4")
+ self.assertEqual(packages["cua-fleet"]["source"], {"registry": "https://pypi.org/simple"})
+ self.assertIn("cua-train", fleet_dependencies)
+ self.assertEqual(fleet_dependencies, {"cua-train"})
+ self.assertEqual(packages["cua-train"]["version"], "0.1.1")
+ self.assertEqual(
+ packages["cua-train"]["source"],
+ {"registry": "https://wheels.cua.ai/simple"},
+ )
+
def test_package_does_not_copy_the_binding_from_the_checkout(self):
self.assertFalse((PROJECT_ROOT / "hatch_build.py").exists())
with PYPROJECT_PATH.open("rb") as pyproject_file:
project = tomllib.load(pyproject_file)
self.assertNotIn("hooks", project.get("tool", {}).get("hatch", {}).get("build", {}))
- def test_fleet_imports_do_not_mutate_paths_or_load_native_libraries(self):
+ def test_fleet_runtime_keeps_binding_imports_direct(self):
for source_path in FLEET_IMPORTS:
source = source_path.read_text()
self.assertIn("from cyclops_sdk import", source)
+ self.assertNotIn("from cua_train", source)
self.assertNotIn("sys.path", source)
self.assertNotIn("site.addsitedir", source)
self.assertNotIn("ctypes.CDLL", source)
diff --git a/libs/python/cua-sandbox/uv.lock b/libs/python/cua-sandbox/uv.lock
index 442d2c0824..dde0d28804 100644
--- a/libs/python/cua-sandbox/uv.lock
+++ b/libs/python/cua-sandbox/uv.lock
@@ -537,6 +537,18 @@ provides-extras = ["otel", "telemetry"]
[package.metadata.requires-dev]
dev = [{ name = "pytest", specifier = ">=8.3.5" }]
+[[package]]
+name = "cua-fleet"
+version = "0.0.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "cua-train" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/e9/2e/c629e6c5c80034fdf3e0274c370670a02e3decd4a716ae55fd426f52c0fe/cua_fleet-0.0.4.tar.gz", hash = "sha256:3c6a922fa800d6cd7fdc35c60a9d77f8f25b7b7b154ddd3b3f6053b5ce28581f", size = 3811, upload-time = "2026-07-26T17:02:18.455Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/24/84/f6be9349312eeb16a85fde9968979af2af042e846ffc26ccd5e17aa27ff3/cua_fleet-0.0.4-py3-none-any.whl", hash = "sha256:8a26610ae663eb231f2444ac4a03f8f8c41803679726e949ea7889ba1fe48766", size = 2393, upload-time = "2026-07-26T17:02:17.52Z" },
+]
+
[[package]]
name = "cua-sandbox"
version = "0.1.17"
@@ -544,7 +556,7 @@ source = { editable = "." }
dependencies = [
{ name = "cua-auto" },
{ name = "cua-core" },
- { name = "cua-train" },
+ { name = "cua-fleet" },
{ name = "grpcio" },
{ name = "httpx" },
{ name = "oras" },
@@ -576,7 +588,7 @@ dev = [
requires-dist = [
{ name = "cua-auto", specifier = ">=0.1.2" },
{ name = "cua-core", specifier = ">=0.3.0,<0.4.0" },
- { name = "cua-train", specifier = "==0.1.1", index = "https://wheels.cua.ai/simple" },
+ { name = "cua-fleet", specifier = "==0.0.4" },
{ name = "grpcio", specifier = "==1.78.0" },
{ name = "httpx", specifier = ">=0.27.0" },
{ name = "oras", specifier = ">=0.2.40" },