use-computer 0.0.7__tar.gz → 0.0.8__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.
- {use_computer-0.0.7 → use_computer-0.0.8}/PKG-INFO +1 -1
- {use_computer-0.0.7 → use_computer-0.0.8}/pyproject.toml +3 -3
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/__init__.py +9 -9
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/ax_transpile.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/client.py +8 -8
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/display.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/errors.py +4 -4
- use_computer-0.0.8/use_computer/ios/__init__.py +14 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/ios/apps.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/ios/environment.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/ios/input.py +1 -1
- use_computer-0.0.8/use_computer/macos/__init__.py +4 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/macos/keyboard.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/macos/mouse.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/parsers.py +3 -3
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/recording.py +1 -1
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/retry.py +2 -2
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/sandbox.py +11 -11
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/__init__.py +1 -1
- use_computer-0.0.7/mmini/ios/__init__.py +0 -14
- use_computer-0.0.7/mmini/macos/__init__.py +0 -4
- use_computer-0.0.7/use_computer/__init__.py +0 -15
- use_computer-0.0.7/use_computer/py.typed +0 -1
- {use_computer-0.0.7 → use_computer-0.0.8}/.env.example +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/.gitignore +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/.pre-commit-config.yaml +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/README.md +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/examples/_1_hello_macos.py +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/examples/_2_hello_ios.py +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/examples/_3_recording.py +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/examples/_4_file_transfer.py +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/examples/_5_keepalive.py +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/models.py +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/py.typed +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/screenshot.py +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/pre_command.sh +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/task.toml +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_ios.sh +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_ios_nograder.sh +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_macos.sh +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_macos_check.sh +0 -0
- {use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_macos_nograder.sh +0 -0
- {use_computer-0.0.7 → use_computer-0.0.8}/uv.lock +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "use-computer"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.8"
|
|
8
8
|
description = "Python SDK for the use.computer macOS and iOS Computer Use API"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -38,7 +38,7 @@ Documentation = "https://api.use.computer/docs"
|
|
|
38
38
|
Repository = "https://github.com/josancamon19/use-computer-python"
|
|
39
39
|
|
|
40
40
|
[tool.hatch.build.targets.wheel]
|
|
41
|
-
packages = ["
|
|
41
|
+
packages = ["use_computer"]
|
|
42
42
|
|
|
43
43
|
[tool.hatch.build]
|
|
44
44
|
exclude = [
|
|
@@ -48,7 +48,7 @@ exclude = [
|
|
|
48
48
|
"/.venv",
|
|
49
49
|
"/dist",
|
|
50
50
|
"/results",
|
|
51
|
-
"/
|
|
51
|
+
"/use_computer/test_*.py",
|
|
52
52
|
]
|
|
53
53
|
|
|
54
54
|
[tool.ruff]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
1
|
+
from use_computer.client import AsyncComputer, Computer, RunStatus
|
|
2
|
+
from use_computer.errors import PlatformNotSupportedError, UseComputerError
|
|
3
|
+
from use_computer.models import (
|
|
4
4
|
ActionResult,
|
|
5
5
|
ActResult,
|
|
6
6
|
CursorPosition,
|
|
@@ -8,8 +8,8 @@ from mmini.models import (
|
|
|
8
8
|
ExecResult,
|
|
9
9
|
RecordingInfo,
|
|
10
10
|
)
|
|
11
|
-
from
|
|
12
|
-
from
|
|
11
|
+
from use_computer.parsers import Action, parse_pyautogui, parse_xdotool
|
|
12
|
+
from use_computer.sandbox import (
|
|
13
13
|
AsyncIOSSandbox,
|
|
14
14
|
AsyncMacOSSandbox,
|
|
15
15
|
AsyncSandbox,
|
|
@@ -18,7 +18,7 @@ from mmini.sandbox import (
|
|
|
18
18
|
Sandbox,
|
|
19
19
|
SandboxType,
|
|
20
20
|
)
|
|
21
|
-
from
|
|
21
|
+
from use_computer.tasks import Task, TasksClient, TaskSummary
|
|
22
22
|
|
|
23
23
|
__all__ = [
|
|
24
24
|
"Action",
|
|
@@ -26,15 +26,15 @@ __all__ = [
|
|
|
26
26
|
"ActResult",
|
|
27
27
|
"AsyncIOSSandbox",
|
|
28
28
|
"AsyncMacOSSandbox",
|
|
29
|
-
"
|
|
29
|
+
"AsyncComputer",
|
|
30
30
|
"AsyncSandbox",
|
|
31
31
|
"CursorPosition",
|
|
32
32
|
"DisplayInfo",
|
|
33
33
|
"ExecResult",
|
|
34
34
|
"IOSSandbox",
|
|
35
35
|
"MacOSSandbox",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"Computer",
|
|
37
|
+
"UseComputerError",
|
|
38
38
|
"PlatformNotSupportedError",
|
|
39
39
|
"RecordingInfo",
|
|
40
40
|
"RunStatus",
|
|
@@ -464,7 +464,7 @@ _B64_PAYLOAD_RE = re.compile(r"echo ([A-Za-z0-9+/=]+) \| base64 -d \| bash")
|
|
|
464
464
|
|
|
465
465
|
def patch_curl_timeouts(text: str) -> tuple[str, int]:
|
|
466
466
|
"""Add -m 5 to `curl -s -X POST` calls that are buried inside base64-encoded
|
|
467
|
-
payloads (the ax_helper emission style). Used by
|
|
467
|
+
payloads (the ax_helper emission style). Used by use_computer._run_setup to harden
|
|
468
468
|
already-baked test.sh files whose payloads were generated before the -m flag
|
|
469
469
|
was added to _emit_helper_call.
|
|
470
470
|
|
|
@@ -8,9 +8,9 @@ from typing import Any, Literal, overload
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
from
|
|
11
|
+
from use_computer.errors import _araise_if_unsupported, _raise_if_unsupported
|
|
12
|
+
from use_computer.retry import AsyncRetryTransport, RetryTransport
|
|
13
|
+
from use_computer.sandbox import (
|
|
14
14
|
AsyncIOSSandbox,
|
|
15
15
|
AsyncMacOSSandbox,
|
|
16
16
|
AsyncSandbox,
|
|
@@ -19,7 +19,7 @@ from mmini.sandbox import (
|
|
|
19
19
|
Sandbox,
|
|
20
20
|
SandboxType,
|
|
21
21
|
)
|
|
22
|
-
from
|
|
22
|
+
from use_computer.tasks import TasksClient
|
|
23
23
|
|
|
24
24
|
DEFAULT_BASE_URL = "https://api.use.computer"
|
|
25
25
|
|
|
@@ -77,8 +77,8 @@ class RunStatus:
|
|
|
77
77
|
)
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
class
|
|
81
|
-
"""
|
|
80
|
+
class Computer:
|
|
81
|
+
"""use.computer client. Creates and manages macOS and iOS sandboxes."""
|
|
82
82
|
|
|
83
83
|
def __init__(self, api_key: str | None = None, base_url: str | None = None):
|
|
84
84
|
self._base_url = _resolve_base_url(base_url)
|
|
@@ -224,8 +224,8 @@ class Mmini:
|
|
|
224
224
|
self.close()
|
|
225
225
|
|
|
226
226
|
|
|
227
|
-
class
|
|
228
|
-
"""Async
|
|
227
|
+
class AsyncComputer:
|
|
228
|
+
"""Async use.computer client."""
|
|
229
229
|
|
|
230
230
|
def __init__(self, api_key: str | None = None, base_url: str | None = None):
|
|
231
231
|
self._base_url = _resolve_base_url(base_url)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Typed exceptions for
|
|
1
|
+
"""Typed exceptions for use.computer SDK errors that callers should catch by class
|
|
2
2
|
rather than by parsing HTTP status codes or response bodies."""
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
@@ -6,11 +6,11 @@ from __future__ import annotations
|
|
|
6
6
|
import httpx
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
10
|
-
"""Base class for typed
|
|
9
|
+
class UseComputerError(Exception):
|
|
10
|
+
"""Base class for typed use.computer SDK errors."""
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class PlatformNotSupportedError(
|
|
13
|
+
class PlatformNotSupportedError(UseComputerError):
|
|
14
14
|
"""Raised when an action is not supported on the sandbox's platform.
|
|
15
15
|
|
|
16
16
|
The gateway returns 501 with a JSON body of the shape:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from use_computer.ios.apps import Apps, AsyncApps
|
|
2
|
+
from use_computer.ios.environment import AsyncEnvironment, Environment
|
|
3
|
+
from use_computer.ios.input import AsyncInput, Button, Input, Key
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"Apps",
|
|
7
|
+
"AsyncApps",
|
|
8
|
+
"AsyncEnvironment",
|
|
9
|
+
"AsyncInput",
|
|
10
|
+
"Button",
|
|
11
|
+
"Environment",
|
|
12
|
+
"Input",
|
|
13
|
+
"Key",
|
|
14
|
+
]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"""Parse pyautogui and xdotool commands into
|
|
1
|
+
"""Parse pyautogui and xdotool commands into use.computer Sandbox calls.
|
|
2
2
|
|
|
3
3
|
Models like Claude and GPT sometimes output raw pyautogui or xdotool commands.
|
|
4
4
|
These parsers translate them into Sandbox method calls.
|
|
5
5
|
|
|
6
6
|
Usage:
|
|
7
|
-
from
|
|
7
|
+
from use_computer.parsers import parse_pyautogui, parse_xdotool
|
|
8
8
|
|
|
9
9
|
for action in parse_pyautogui("pyautogui.click(100, 200)"):
|
|
10
10
|
action.execute(sandbox)
|
|
@@ -20,7 +20,7 @@ from dataclasses import dataclass, field
|
|
|
20
20
|
from typing import TYPE_CHECKING, Any
|
|
21
21
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
|
-
from
|
|
23
|
+
from use_computer.sandbox import Sandbox
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
@dataclass
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Single retry layer for all
|
|
1
|
+
"""Single retry layer for all use.computer SDK HTTP calls.
|
|
2
2
|
|
|
3
3
|
Retries are handled at the httpx transport level so they apply
|
|
4
4
|
automatically to every request — no per-method wrappers needed.
|
|
@@ -12,7 +12,7 @@ import time
|
|
|
12
12
|
|
|
13
13
|
import httpx
|
|
14
14
|
|
|
15
|
-
_log = logging.getLogger("
|
|
15
|
+
_log = logging.getLogger("use_computer.retry")
|
|
16
16
|
|
|
17
17
|
RETRYABLE_EXCEPTIONS = (
|
|
18
18
|
httpx.TimeoutException,
|
|
@@ -9,15 +9,15 @@ from pathlib import Path
|
|
|
9
9
|
|
|
10
10
|
import httpx
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
12
|
+
from use_computer.display import AsyncDisplay, Display
|
|
13
|
+
from use_computer.ios.apps import Apps, AsyncApps
|
|
14
|
+
from use_computer.ios.environment import AsyncEnvironment, Environment
|
|
15
|
+
from use_computer.ios.input import AsyncInput, Input
|
|
16
|
+
from use_computer.macos.keyboard import AsyncKeyboard, Keyboard
|
|
17
|
+
from use_computer.macos.mouse import AsyncMouse, Mouse
|
|
18
|
+
from use_computer.models import ActResult, ExecResult
|
|
19
|
+
from use_computer.recording import AsyncRecording, Recording
|
|
20
|
+
from use_computer.screenshot import AsyncScreenshot, Screenshot
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
class SandboxType(str, Enum):
|
|
@@ -222,7 +222,7 @@ class MacOSSandbox(Sandbox):
|
|
|
222
222
|
with tarfile.open(fileobj=buf, mode="w:gz") as tar:
|
|
223
223
|
for item in local_dir.rglob("*"):
|
|
224
224
|
tar.add(str(item), arcname=str(item.relative_to(local_dir)))
|
|
225
|
-
tmp = f"/tmp/
|
|
225
|
+
tmp = f"/tmp/_use_computer_upload_{self.sandbox_id[-8:]}.tar.gz"
|
|
226
226
|
self.upload_bytes(buf.getvalue(), tmp)
|
|
227
227
|
self.exec_ssh(f'mkdir -p "{remote_dir}" && tar xzf {tmp} -C "{remote_dir}" && rm -f {tmp}')
|
|
228
228
|
|
|
@@ -390,7 +390,7 @@ class AsyncMacOSSandbox(AsyncSandbox):
|
|
|
390
390
|
with tarfile.open(fileobj=buf, mode="w:gz") as tar:
|
|
391
391
|
for item in local_dir.rglob("*"):
|
|
392
392
|
tar.add(str(item), arcname=str(item.relative_to(local_dir)))
|
|
393
|
-
tmp = f"/tmp/
|
|
393
|
+
tmp = f"/tmp/_use_computer_upload_{self.sandbox_id[-8:]}.tar.gz"
|
|
394
394
|
await self.upload_bytes(buf.getvalue(), tmp)
|
|
395
395
|
cmd = f'mkdir -p "{remote_dir}" && tar xzf {tmp} -C "{remote_dir}" && rm -f {tmp}'
|
|
396
396
|
await self.exec_ssh(cmd)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from mmini.ios.apps import Apps, AsyncApps
|
|
2
|
-
from mmini.ios.environment import AsyncEnvironment, Environment
|
|
3
|
-
from mmini.ios.input import AsyncInput, Button, Input, Key
|
|
4
|
-
|
|
5
|
-
__all__ = [
|
|
6
|
-
"Apps",
|
|
7
|
-
"AsyncApps",
|
|
8
|
-
"AsyncEnvironment",
|
|
9
|
-
"AsyncInput",
|
|
10
|
-
"Button",
|
|
11
|
-
"Environment",
|
|
12
|
-
"Input",
|
|
13
|
-
"Key",
|
|
14
|
-
]
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import mmini as _mmini
|
|
4
|
-
from mmini import * # noqa: F403
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Computer(_mmini.Mmini):
|
|
8
|
-
"""use.computer client."""
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class AsyncComputer(_mmini.AsyncMmini):
|
|
12
|
-
"""Async use.computer client."""
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
__all__ = [*_mmini.__all__, "AsyncComputer", "Computer"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
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
|
{use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_ios_nograder.sh
RENAMED
|
File without changes
|
|
File without changes
|
{use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_macos_check.sh
RENAMED
|
File without changes
|
{use_computer-0.0.7/mmini → use_computer-0.0.8/use_computer}/tasks/templates/test_macos_nograder.sh
RENAMED
|
File without changes
|
|
File without changes
|