oagi 0.6.0__tar.gz → 0.6.2__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.

Potentially problematic release.


This version of oagi might be problematic. Click here for more details.

Files changed (63) hide show
  1. {oagi-0.6.0 → oagi-0.6.2}/PKG-INFO +1 -1
  2. {oagi-0.6.0 → oagi-0.6.2}/pyproject.toml +1 -1
  3. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/__init__.py +32 -14
  4. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/async_single_step.py +3 -3
  5. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/pil_image.py +2 -1
  6. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/single_step.py +3 -1
  7. {oagi-0.6.0 → oagi-0.6.2}/tests/test_pil_image.py +1 -1
  8. {oagi-0.6.0 → oagi-0.6.2}/tests/test_screenshot_maker.py +8 -8
  9. {oagi-0.6.0 → oagi-0.6.2}/uv.lock +1 -1
  10. {oagi-0.6.0 → oagi-0.6.2}/.github/workflows/ci.yml +0 -0
  11. {oagi-0.6.0 → oagi-0.6.2}/.github/workflows/release.yml +0 -0
  12. {oagi-0.6.0 → oagi-0.6.2}/.gitignore +0 -0
  13. {oagi-0.6.0 → oagi-0.6.2}/.python-version +0 -0
  14. {oagi-0.6.0 → oagi-0.6.2}/CONTRIBUTING.md +0 -0
  15. {oagi-0.6.0 → oagi-0.6.2}/LICENSE +0 -0
  16. {oagi-0.6.0 → oagi-0.6.2}/Makefile +0 -0
  17. {oagi-0.6.0 → oagi-0.6.2}/README.md +0 -0
  18. {oagi-0.6.0 → oagi-0.6.2}/examples/async_google_weather.py +0 -0
  19. {oagi-0.6.0 → oagi-0.6.2}/examples/continued_session.py +0 -0
  20. {oagi-0.6.0 → oagi-0.6.2}/examples/execute_task_auto.py +0 -0
  21. {oagi-0.6.0 → oagi-0.6.2}/examples/execute_task_manual.py +0 -0
  22. {oagi-0.6.0 → oagi-0.6.2}/examples/google_weather.py +0 -0
  23. {oagi-0.6.0 → oagi-0.6.2}/examples/hotel_booking.py +0 -0
  24. {oagi-0.6.0 → oagi-0.6.2}/examples/screenshot_with_config.py +0 -0
  25. {oagi-0.6.0 → oagi-0.6.2}/examples/single_step.py +0 -0
  26. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/async_pyautogui_action_handler.py +0 -0
  27. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/async_screenshot_maker.py +0 -0
  28. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/client/__init__.py +0 -0
  29. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/client/async_.py +0 -0
  30. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/client/base.py +0 -0
  31. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/client/sync.py +0 -0
  32. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/exceptions.py +0 -0
  33. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/logging.py +0 -0
  34. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/pyautogui_action_handler.py +0 -0
  35. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/screenshot_maker.py +0 -0
  36. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/__init__.py +0 -0
  37. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/async_.py +0 -0
  38. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/async_short.py +0 -0
  39. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/base.py +0 -0
  40. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/short.py +0 -0
  41. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/task/sync.py +0 -0
  42. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/__init__.py +0 -0
  43. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/action_handler.py +0 -0
  44. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/async_action_handler.py +0 -0
  45. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/async_image_provider.py +0 -0
  46. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/image.py +0 -0
  47. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/image_provider.py +0 -0
  48. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/models/__init__.py +0 -0
  49. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/models/action.py +0 -0
  50. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/models/client.py +0 -0
  51. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/models/image_config.py +0 -0
  52. {oagi-0.6.0 → oagi-0.6.2}/src/oagi/types/models/step.py +0 -0
  53. {oagi-0.6.0 → oagi-0.6.2}/tests/__init__.py +0 -0
  54. {oagi-0.6.0 → oagi-0.6.2}/tests/conftest.py +0 -0
  55. {oagi-0.6.0 → oagi-0.6.2}/tests/test_async_client.py +0 -0
  56. {oagi-0.6.0 → oagi-0.6.2}/tests/test_async_handlers.py +0 -0
  57. {oagi-0.6.0 → oagi-0.6.2}/tests/test_async_task.py +0 -0
  58. {oagi-0.6.0 → oagi-0.6.2}/tests/test_logging.py +0 -0
  59. {oagi-0.6.0 → oagi-0.6.2}/tests/test_pyautogui_action_handler.py +0 -0
  60. {oagi-0.6.0 → oagi-0.6.2}/tests/test_short_task.py +0 -0
  61. {oagi-0.6.0 → oagi-0.6.2}/tests/test_single_step.py +0 -0
  62. {oagi-0.6.0 → oagi-0.6.2}/tests/test_sync_client.py +0 -0
  63. {oagi-0.6.0 → oagi-0.6.2}/tests/test_task.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: oagi
3
- Version: 0.6.0
3
+ Version: 0.6.2
4
4
  Summary: Official API of OpenAGI Foundation
5
5
  Project-URL: Homepage, https://github.com/agiopen-org/oagi
6
6
  Author-email: OpenAGI Foundation <contact@agiopen.org>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "oagi"
7
- version = "0.6.0"
7
+ version = "0.6.2"
8
8
  description = "Official API of OpenAGI Foundation"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
@@ -5,9 +5,8 @@
5
5
  # This file is part of the official API project.
6
6
  # Licensed under the MIT License.
7
7
  # -----------------------------------------------------------------------------
8
+ import importlib
8
9
 
9
- from oagi.async_pyautogui_action_handler import AsyncPyautoguiActionHandler
10
- from oagi.async_screenshot_maker import AsyncScreenshotMaker
11
10
  from oagi.async_single_step import async_single_step
12
11
  from oagi.client import AsyncClient, SyncClient
13
12
  from oagi.exceptions import (
@@ -22,9 +21,6 @@ from oagi.exceptions import (
22
21
  ServerError,
23
22
  ValidationError,
24
23
  )
25
- from oagi.pil_image import PILImage
26
- from oagi.pyautogui_action_handler import PyautoguiActionHandler, PyautoguiConfig
27
- from oagi.screenshot_maker import ScreenshotMaker
28
24
  from oagi.single_step import single_step
29
25
  from oagi.task import AsyncShortTask, AsyncTask, ShortTask, Task
30
26
  from oagi.types import (
@@ -34,6 +30,27 @@ from oagi.types import (
34
30
  )
35
31
  from oagi.types.models import ErrorDetail, ErrorResponse, LLMResponse
36
32
 
33
+ # Lazy imports for pyautogui-dependent modules
34
+ # These will only be imported when actually accessed
35
+ _LAZY_IMPORTS = {
36
+ "AsyncPyautoguiActionHandler": "oagi.async_pyautogui_action_handler",
37
+ "AsyncScreenshotMaker": "oagi.async_screenshot_maker",
38
+ "PILImage": "oagi.pil_image",
39
+ "PyautoguiActionHandler": "oagi.pyautogui_action_handler",
40
+ "PyautoguiConfig": "oagi.pyautogui_action_handler",
41
+ "ScreenshotMaker": "oagi.screenshot_maker",
42
+ }
43
+
44
+
45
+ def __getattr__(name: str):
46
+ """Lazy import for pyautogui-dependent modules."""
47
+ if name in _LAZY_IMPORTS:
48
+ module_name = _LAZY_IMPORTS[name]
49
+ module = importlib.import_module(module_name)
50
+ return getattr(module, name)
51
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
52
+
53
+
37
54
  __all__ = [
38
55
  # Core sync classes
39
56
  "Task",
@@ -46,15 +63,6 @@ __all__ = [
46
63
  # Functions
47
64
  "single_step",
48
65
  "async_single_step",
49
- # Image classes
50
- "PILImage",
51
- # Handler classes
52
- "PyautoguiActionHandler",
53
- "PyautoguiConfig",
54
- "ScreenshotMaker",
55
- # Async handler classes
56
- "AsyncPyautoguiActionHandler",
57
- "AsyncScreenshotMaker",
58
66
  # Async protocols
59
67
  "AsyncActionHandler",
60
68
  "AsyncImageProvider",
@@ -75,4 +83,14 @@ __all__ = [
75
83
  "ServerError",
76
84
  "RequestTimeoutError",
77
85
  "ValidationError",
86
+ # Lazy imports
87
+ # Image classes
88
+ "PILImage",
89
+ # Handler classes
90
+ "PyautoguiActionHandler",
91
+ "PyautoguiConfig",
92
+ "ScreenshotMaker",
93
+ # Async handler classes
94
+ "AsyncPyautoguiActionHandler",
95
+ "AsyncScreenshotMaker",
78
96
  ]
@@ -8,7 +8,6 @@
8
8
 
9
9
  from pathlib import Path
10
10
 
11
- from .pil_image import PILImage
12
11
  from .task import AsyncTask
13
12
  from .types import Image, Step
14
13
 
@@ -64,12 +63,13 @@ async def async_single_step(
64
63
  ... screenshot=image
65
64
  ... )
66
65
  """
66
+ # Lazy import PILImage only when needed
67
+ from .pil_image import PILImage # noqa: PLC0415
68
+
67
69
  # Handle different screenshot input types
68
70
  if isinstance(screenshot, (str, Path)):
69
- # Convert file path to PILImage
70
71
  screenshot = PILImage.from_file(str(screenshot))
71
72
  elif isinstance(screenshot, bytes):
72
- # Convert bytes to PILImage
73
73
  screenshot = PILImage.from_bytes(screenshot)
74
74
 
75
75
  # Create a temporary task instance
@@ -9,7 +9,6 @@
9
9
  import io
10
10
  from typing import Optional
11
11
 
12
- import pyautogui
13
12
  from PIL import Image as PILImageLib
14
13
 
15
14
  from .types.models.image_config import ImageConfig
@@ -39,6 +38,8 @@ class PILImage:
39
38
  @classmethod
40
39
  def from_screenshot(cls, config: ImageConfig | None = None) -> "PILImage":
41
40
  """Create PILImage from screenshot."""
41
+ import pyautogui # noqa: PLC0415, avoid no DISPLAY issue in headless environment
42
+
42
43
  screenshot = pyautogui.screenshot()
43
44
  return cls(screenshot, config)
44
45
 
@@ -8,7 +8,6 @@
8
8
 
9
9
  from pathlib import Path
10
10
 
11
- from .pil_image import PILImage
12
11
  from .task import Task
13
12
  from .types import Image, Step
14
13
 
@@ -62,6 +61,9 @@ def single_step(
62
61
  ... screenshot=image
63
62
  ... )
64
63
  """
64
+ # Lazy import PILImage only when needed
65
+ from .pil_image import PILImage # noqa: PLC0415
66
+
65
67
  # Convert file paths to bytes using PILImage
66
68
  if isinstance(screenshot, (str, Path)):
67
69
  path = Path(screenshot) if isinstance(screenshot, str) else screenshot
@@ -224,7 +224,7 @@ class TestPILImageFactoryMethods:
224
224
  assert isinstance(result, PILImage)
225
225
  assert result.image is mock_image
226
226
 
227
- @patch("oagi.pil_image.pyautogui.screenshot")
227
+ @patch("pyautogui.screenshot")
228
228
  def test_from_screenshot(self, mock_screenshot):
229
229
  mock_image = MagicMock()
230
230
  mock_screenshot.return_value = mock_image
@@ -27,7 +27,7 @@ def mock_screenshot_image():
27
27
 
28
28
 
29
29
  class TestScreenshotMaker:
30
- @patch("oagi.pil_image.pyautogui.screenshot")
30
+ @patch("pyautogui.screenshot")
31
31
  def test_screenshot_maker_takes_screenshot(
32
32
  self, mock_screenshot, mock_screenshot_image
33
33
  ):
@@ -42,7 +42,7 @@ class TestScreenshotMaker:
42
42
  assert isinstance(result, PILImage)
43
43
  assert result.image is mock_resized_image
44
44
 
45
- @patch("oagi.pil_image.pyautogui.screenshot")
45
+ @patch("pyautogui.screenshot")
46
46
  def test_screenshot_maker_stores_last_screenshot(self, mock_screenshot):
47
47
  def create_mock_image():
48
48
  mock = MagicMock()
@@ -66,7 +66,7 @@ class TestScreenshotMaker:
66
66
  assert maker.last_image() is second
67
67
  assert maker.last_image() is not first
68
68
 
69
- @patch("oagi.pil_image.pyautogui.screenshot")
69
+ @patch("pyautogui.screenshot")
70
70
  def test_screenshot_maker_last_image_creates_if_none(
71
71
  self, mock_screenshot, mock_screenshot_image
72
72
  ):
@@ -79,7 +79,7 @@ class TestScreenshotMaker:
79
79
  mock_screenshot.assert_called_once()
80
80
  assert isinstance(result, PILImage)
81
81
 
82
- @patch("oagi.pil_image.pyautogui.screenshot")
82
+ @patch("pyautogui.screenshot")
83
83
  def test_screenshot_image_returns_png_bytes(self, mock_screenshot):
84
84
  pil_image = PILImageLib.new("RGB", (10, 10), color="red")
85
85
  mock_screenshot.return_value = pil_image
@@ -99,7 +99,7 @@ class TestScreenshotMaker:
99
99
  (None, 600, (1920, 600)), # Uses original width
100
100
  ],
101
101
  )
102
- @patch("oagi.pil_image.pyautogui.screenshot")
102
+ @patch("pyautogui.screenshot")
103
103
  def test_screenshot_maker_resize_dimensions(
104
104
  self, mock_screenshot, mock_screenshot_image, width, height, expected_size
105
105
  ):
@@ -123,7 +123,7 @@ class TestScreenshotMaker:
123
123
  ("PNG", b"\x89PNG\r\n\x1a\n"),
124
124
  ],
125
125
  )
126
- @patch("oagi.pil_image.pyautogui.screenshot")
126
+ @patch("pyautogui.screenshot")
127
127
  def test_screenshot_maker_format_output(
128
128
  self, mock_screenshot, format_name, expected_signature
129
129
  ):
@@ -140,7 +140,7 @@ class TestScreenshotMaker:
140
140
  result_image = PILImageLib.open(BytesIO(image_bytes))
141
141
  assert result_image.format == format_name
142
142
 
143
- @patch("oagi.pil_image.pyautogui.screenshot")
143
+ @patch("pyautogui.screenshot")
144
144
  def test_screenshot_maker_default_resize_1260x700(
145
145
  self, mock_screenshot, mock_screenshot_image
146
146
  ):
@@ -156,7 +156,7 @@ class TestScreenshotMaker:
156
156
  assert isinstance(result, PILImage)
157
157
  assert result.image is mock_resized_image
158
158
 
159
- @patch("oagi.pil_image.pyautogui.screenshot")
159
+ @patch("pyautogui.screenshot")
160
160
  def test_resize_happens_before_format_conversion(self, mock_screenshot):
161
161
  original_image = PILImageLib.new("RGB", (2000, 1000), color="green")
162
162
  mock_screenshot.return_value = original_image
@@ -138,7 +138,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/28/fa/b2ba8229b9381e8f6
138
138
 
139
139
  [[package]]
140
140
  name = "oagi"
141
- version = "0.6.0"
141
+ version = "0.6.2"
142
142
  source = { editable = "." }
143
143
  dependencies = [
144
144
  { name = "httpx" },
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes