droidrun 0.3.6__py3-none-any.whl → 0.3.7__py3-none-any.whl

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.
droidrun/portal.py CHANGED
@@ -1,11 +1,13 @@
1
- import requests
2
- import tempfile
3
- import os
4
1
  import contextlib
5
- from adbutils import adb, AdbDevice
6
- from droidrun.tools import AdbTools
2
+ import os
3
+ import tempfile
4
+
5
+ import requests
6
+ from adbutils import AdbDevice, adb
7
7
  from rich.console import Console
8
8
 
9
+ from droidrun.tools import AdbTools
10
+
9
11
  REPO = "droidrun/droidrun-portal"
10
12
  ASSET_NAME = "droidrun-portal"
11
13
  GITHUB_API_HOSTS = ["https://api.github.com", "https://ungh.cc"]
@@ -96,7 +98,7 @@ def check_portal_accessibility(
96
98
  device: AdbDevice, service_name: str = A11Y_SERVICE_NAME, debug: bool = False
97
99
  ) -> bool:
98
100
  a11y_services = device.shell("settings get secure enabled_accessibility_services")
99
- if not service_name in a11y_services:
101
+ if service_name not in a11y_services:
100
102
  if debug:
101
103
  print(a11y_services)
102
104
  return False
@@ -117,9 +119,9 @@ def ping_portal(device: AdbDevice, debug: bool = False):
117
119
  try:
118
120
  packages = device.list_packages()
119
121
  except Exception as e:
120
- raise Exception(f"Failed to list packages: {e}")
122
+ raise Exception("Failed to list packages") from e
121
123
 
122
- if not PORTAL_PACKAGE_NAME in packages:
124
+ if PORTAL_PACKAGE_NAME not in packages:
123
125
  if debug:
124
126
  print(packages)
125
127
  raise Exception("Portal is not installed on the device")
@@ -134,17 +136,17 @@ def ping_portal(device: AdbDevice, debug: bool = False):
134
136
  def ping_portal_content(device: AdbDevice, debug: bool = False):
135
137
  try:
136
138
  state = device.shell("content query --uri content://com.droidrun.portal/state")
137
- if not "Row: 0 result=" in state:
139
+ if "Row: 0 result=" not in state:
138
140
  raise Exception("Failed to get state from Droidrun Portal")
139
141
  except Exception as e:
140
- raise Exception(f"Droidrun Portal is not reachable: {e}")
142
+ raise Exception("Droidrun Portal is not reachable") from e
141
143
 
142
144
 
143
145
  def ping_portal_tcp(device: AdbDevice, debug: bool = False):
144
146
  try:
145
147
  tools = AdbTools(serial=device.serial, use_tcp=True)
146
148
  except Exception as e:
147
- raise Exception(f"Failed to setup TCP forwarding: {e}")
149
+ raise Exception("Failed to setup TCP forwarding") from e
148
150
 
149
151
 
150
152
  def set_overlay_offset(device: AdbDevice, offset: int):
@@ -155,8 +157,38 @@ def set_overlay_offset(device: AdbDevice, offset: int):
155
157
  cmd = f'content insert --uri "content://com.droidrun.portal/overlay_offset" --bind offset:i:{offset}'
156
158
  device.shell(cmd)
157
159
  except Exception as e:
158
- raise Exception(f"Error setting overlay offset: {str(e)}")
160
+ raise Exception("Error setting overlay offset") from e
161
+
162
+ def toggle_overlay(device: AdbDevice, visible: bool):
163
+ """toggle the overlay visibility.
164
+
165
+ Args:
166
+ device: Device to toggle the overlay on
167
+ visible: Whether to show the overlay
168
+
169
+ throws:
170
+ Exception: If the overlay toggle fails
171
+ """
172
+ try:
173
+ device.shell(
174
+ f"am broadcast -a com.droidrun.portal.TOGGLE_OVERLAY --ez overlay_visible {'true' if visible else 'false'}"
175
+ )
176
+ except Exception as e:
177
+ raise Exception("Failed to toggle overlay") from e
159
178
 
179
+ def setup_keyboard(device: AdbDevice):
180
+ """
181
+ Set up the DroidRun keyboard as the default input method.
182
+ Simple setup that just switches to DroidRun keyboard without saving/restoring.
183
+
184
+ throws:
185
+ Exception: If the keyboard setup fails
186
+ """
187
+ try:
188
+ device.shell("ime enable com.droidrun.portal/.DroidrunKeyboardIME")
189
+ device.shell("ime set com.droidrun.portal/.DroidrunKeyboardIME")
190
+ except Exception as e:
191
+ raise Exception("Error setting up keyboard") from e
160
192
 
161
193
  def test():
162
194
  device = adb.device()
droidrun/tools/adb.py CHANGED
@@ -831,8 +831,6 @@ class AdbTools(Tools):
831
831
  data_str = None
832
832
  if "data" in state_data:
833
833
  data_str = state_data["data"]
834
- elif "message" in state_data:
835
- data_str = state_data["message"]
836
834
 
837
835
  if data_str:
838
836
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: droidrun
3
- Version: 0.3.6
3
+ Version: 0.3.7
4
4
  Summary: A framework for controlling Android devices through LLM agents
5
5
  Project-URL: Homepage, https://github.com/droidrun/droidrun
6
6
  Project-URL: Bug Tracker, https://github.com/droidrun/droidrun/issues
@@ -27,25 +27,30 @@ Classifier: Topic :: System :: Emulators
27
27
  Classifier: Topic :: Utilities
28
28
  Requires-Python: >=3.11
29
29
  Requires-Dist: adbutils>=2.10.2
30
- Requires-Dist: anthropic>=0.67.0
31
30
  Requires-Dist: apkutils==2.0.0
32
- Requires-Dist: llama-index-llms-anthropic>=0.8.6
33
- Requires-Dist: llama-index-llms-deepseek>=0.2.1
34
- Requires-Dist: llama-index-llms-google-genai>=0.3.1
35
- Requires-Dist: llama-index-llms-ollama>=0.7.2
36
- Requires-Dist: llama-index-llms-openai-like>=0.5.1
37
- Requires-Dist: llama-index-llms-openai>=0.5.6
38
- Requires-Dist: llama-index>=0.14.0
39
- Requires-Dist: openai>=1.107.1
31
+ Requires-Dist: llama-index>=0.13.6
40
32
  Requires-Dist: posthog>=6.7.4
41
33
  Requires-Dist: pydantic>=2.11.7
42
34
  Requires-Dist: rich>=14.1.0
35
+ Provides-Extra: anthropic
36
+ Requires-Dist: anthropic>=0.67.0; extra == 'anthropic'
37
+ Requires-Dist: llama-index-llms-anthropic>=0.8.6; extra == 'anthropic'
38
+ Provides-Extra: deepseek
39
+ Requires-Dist: llama-index-llms-deepseek>=0.2.1; extra == 'deepseek'
43
40
  Provides-Extra: dev
44
41
  Requires-Dist: bandit>=1.8.6; extra == 'dev'
45
42
  Requires-Dist: black>=23.0.0; extra == 'dev'
46
43
  Requires-Dist: mypy>=1.0.0; extra == 'dev'
47
44
  Requires-Dist: ruff>=0.13.0; extra == 'dev'
48
45
  Requires-Dist: safety>=3.2.11; extra == 'dev'
46
+ Provides-Extra: google
47
+ Requires-Dist: llama-index-llms-google-genai>=0.3.1; extra == 'google'
48
+ Provides-Extra: ollama
49
+ Requires-Dist: llama-index-llms-ollama>=0.7.2; extra == 'ollama'
50
+ Provides-Extra: openai
51
+ Requires-Dist: llama-index-llms-openai-like>=0.5.1; extra == 'openai'
52
+ Requires-Dist: llama-index-llms-openai>=0.5.6; extra == 'openai'
53
+ Requires-Dist: openai>=1.107.1; extra == 'openai'
49
54
  Description-Content-Type: text/markdown
50
55
 
51
56
  <picture>
@@ -83,7 +88,7 @@ DroidRun is a powerful framework for controlling Android and iOS devices through
83
88
  ## 📦 Installation
84
89
 
85
90
  ```bash
86
- pip install droidrun
91
+ pip install droidrun[google,anthropic,openai,deepseek,ollama,dev]
87
92
  ```
88
93
 
89
94
  ## 🚀 Quickstart
@@ -1,6 +1,6 @@
1
1
  droidrun/__init__.py,sha256=Cqt4NXZ-753220dlRZXglMkFT2ygcXSErMmqupGsi9A,622
2
2
  droidrun/__main__.py,sha256=78o1Wr_Z-NrZy9yLWmEfNfRRhAiJGBr4Xi3lmbgkx3w,105
3
- droidrun/portal.py,sha256=K9Yh2Lq6AC_7Qf5ySYuZr3CpYtN3hoD9cGy4D7I4zCc,5151
3
+ droidrun/portal.py,sha256=4-1lNc28yxDSkg2qf_t36gXzTSflcJqfsxggYpUwmio,6169
4
4
  droidrun/agent/__init__.py,sha256=4SqTJeGDvr_wT8rtN9J8hnN6P-pae663mkYr-JmzH4w,208
5
5
  droidrun/agent/usage.py,sha256=ZTgqxRAgugJ9tk6ApZ2BJ5nB88pt9rhLyTFS5AnVUHo,7153
6
6
  droidrun/agent/codeact/__init__.py,sha256=ZLDGT_lTTzyNm7pcBzdyRIGHJ2ZgbInJdhXZRbJLhSQ,278
@@ -45,11 +45,11 @@ droidrun/telemetry/__init__.py,sha256=D4Mp02iGJH2Tjpv42Bzyo6_WC3NWj9Qy9hQPWFaCkh
45
45
  droidrun/telemetry/events.py,sha256=OIYIs5stZtKz0g82W8WFE_h6q3jh0vUhc9_CwNTJ3a4,529
46
46
  droidrun/telemetry/tracker.py,sha256=Ljue6zivX8KnadXI9DivrayuWxAnUwbJKvCvNtY1Y4Y,2717
47
47
  droidrun/tools/__init__.py,sha256=9ReauavtSKDQG9ya9_Fr9O0TQnDFixgOPaP5n82_iEk,271
48
- droidrun/tools/adb.py,sha256=O4bl23QTIOG_ng1ukdWg87n01FVhNoSi3dBdgL6oaqs,38409
48
+ droidrun/tools/adb.py,sha256=91HmimUJtvGyMcE2HEDJLvTQt95ZYNCXWAJlOs4X9HQ,38302
49
49
  droidrun/tools/ios.py,sha256=imzojiS6gqz4IKexUEz1ga7-flSOaC5QRpHIJTwcgSQ,21807
50
50
  droidrun/tools/tools.py,sha256=Swlzo9A8B8YcgU6XNHRG1LNpo_-RljzhyVhnEYYm-G4,4772
51
- droidrun-0.3.6.dist-info/METADATA,sha256=3iRkXCLUc8DjEDB0a89zXuhriSIZh5bytsVm8yWQDI8,6535
52
- droidrun-0.3.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- droidrun-0.3.6.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
54
- droidrun-0.3.6.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
55
- droidrun-0.3.6.dist-info/RECORD,,
51
+ droidrun-0.3.7.dist-info/METADATA,sha256=0bBaBhRe06W_72e-eRtnnHDTTK2KXEQZx82gcaBhuYo,6860
52
+ droidrun-0.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ droidrun-0.3.7.dist-info/entry_points.txt,sha256=o259U66js8TIybQ7zs814Oe_LQ_GpZsp6a9Cr-xm5zE,51
54
+ droidrun-0.3.7.dist-info/licenses/LICENSE,sha256=s-uxn9qChu-kFdRXUp6v_0HhsaJ_5OANmfNOFVm2zdk,1069
55
+ droidrun-0.3.7.dist-info/RECORD,,