pythonhere 0.2.2__tar.gz → 0.3.1__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.
- {pythonhere-0.2.2/pythonhere.egg-info → pythonhere-0.3.1}/PKG-INFO +11 -2
- {pythonhere-0.2.2 → pythonhere-0.3.1}/README.rst +9 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pyproject.toml +4 -1
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/SKILL.md +241 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/agents/openai.yaml +4 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/able.md +554 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/android-permissions.md +195 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/kivy-kv.md +241 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/kivy-runtime.md +305 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/midi.md +248 -0
- pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references/plyer.md +202 -0
- pythonhere-0.3.1/pythonhere/magic_here/prompts/android-media.md +130 -0
- pythonhere-0.3.1/pythonhere/magic_here/prompts/android-packages.md +69 -0
- pythonhere-0.3.1/pythonhere/magic_here/prompts/android-runtime.md +34 -0
- pythonhere-0.3.1/pythonhere/magic_here/prompts/jnius.md +432 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/shortcuts.py +2 -2
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/server_here.py +1 -1
- pythonhere-0.3.1/pythonhere/tools_here.py +359 -0
- pythonhere-0.3.1/pythonhere/version_here.py +1 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/window_here.py +24 -9
- {pythonhere-0.2.2 → pythonhere-0.3.1/pythonhere.egg-info}/PKG-INFO +11 -2
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere.egg-info/SOURCES.txt +15 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere.egg-info/requires.txt +1 -1
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_main.py +37 -0
- pythonhere-0.3.1/tests/test_pythonhere_skill.py +86 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_server_here.py +47 -1
- pythonhere-0.3.1/tests/test_tools_here.py +659 -0
- pythonhere-0.2.2/pythonhere/version_here.py +0 -1
- {pythonhere-0.2.2 → pythonhere-0.3.1}/LICENSE +0 -0
- {pythonhere-0.2.2/pythonhere/magic_here/prompts → pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references}/android-media.md +0 -0
- {pythonhere-0.2.2/pythonhere/magic_here/prompts → pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references}/android-packages.md +0 -0
- {pythonhere-0.2.2/pythonhere/magic_here/prompts → pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references}/android-runtime.md +0 -0
- {pythonhere-0.2.2/pythonhere/magic_here/prompts → pythonhere-0.3.1/pythonhere/.agents/skills/pythonhere/references}/jnius.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/__init__.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/android_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/data/logo/logo-128.png +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/data/logo/logo-32.png +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/data/logo/logo-splash.png +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/enum_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/exception_manager_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/exception_manager_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/launcher_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/__init__.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/README.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/able.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/android-permissions.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/kivy-kv.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/kivy-runtime.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/midi.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts/plyer.md +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/magic_here/prompts.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/main.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/network_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/patches_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/pythonhere.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/__init__.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/actionbar_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/common_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/connection_address_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/connection_address_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/layout_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/server_screen_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/server_screen_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/settings_here.kv +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere/ui_here/settings_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere.egg-info/dependency_links.txt +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/pythonhere.egg-info/top_level.txt +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/setup.cfg +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/setup.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_ai_prompts.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_android_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_exception_manager_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_launcher_here.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_magic.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_network.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_patches.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_settings.py +0 -0
- {pythonhere-0.2.2 → pythonhere-0.3.1}/tests/test_window_here.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonhere
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.1
|
|
4
4
|
Summary: Here is the Kivy based app to run code from the Jupyter magic %there
|
|
5
5
|
Author-email: b3b <ash.b3b@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
16
16
|
Requires-Python: >=3.10
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
18
|
License-File: LICENSE
|
|
19
|
-
Requires-Dist: herethere[magic]>=0.2
|
|
19
|
+
Requires-Dist: herethere[magic]>=0.3.2
|
|
20
20
|
Requires-Dist: ipython
|
|
21
21
|
Requires-Dist: ipywidgets
|
|
22
22
|
Requires-Dist: Pillow
|
|
@@ -111,6 +111,15 @@ Commands to run locally::
|
|
|
111
111
|
jupyter notebook
|
|
112
112
|
|
|
113
113
|
|
|
114
|
+
Coding agents
|
|
115
|
+
-------------
|
|
116
|
+
|
|
117
|
+
PythonHere includes agent skills for working with the live app through the
|
|
118
|
+
``there`` command-line interface. See `Coding agent skills
|
|
119
|
+
<https://herethere.me/pythonhere/examples/coding-agents.html>`_ for skill setup
|
|
120
|
+
and practical examples.
|
|
121
|
+
|
|
122
|
+
|
|
114
123
|
Build Android app
|
|
115
124
|
-----------------
|
|
116
125
|
|
|
@@ -87,6 +87,15 @@ Commands to run locally::
|
|
|
87
87
|
jupyter notebook
|
|
88
88
|
|
|
89
89
|
|
|
90
|
+
Coding agents
|
|
91
|
+
-------------
|
|
92
|
+
|
|
93
|
+
PythonHere includes agent skills for working with the live app through the
|
|
94
|
+
``there`` command-line interface. See `Coding agent skills
|
|
95
|
+
<https://herethere.me/pythonhere/examples/coding-agents.html>`_ for skill setup
|
|
96
|
+
and practical examples.
|
|
97
|
+
|
|
98
|
+
|
|
90
99
|
Build Android app
|
|
91
100
|
-----------------
|
|
92
101
|
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
"Programming Language :: Python :: 3.14",
|
|
23
23
|
]
|
|
24
24
|
dependencies = [
|
|
25
|
-
"herethere[magic]>=0.2
|
|
25
|
+
"herethere[magic]>=0.3.2",
|
|
26
26
|
"ipython",
|
|
27
27
|
"ipywidgets",
|
|
28
28
|
"Pillow",
|
|
@@ -75,6 +75,9 @@ version = { attr = "pythonhere.version_here.__version__" }
|
|
|
75
75
|
|
|
76
76
|
[tool.setuptools.package-data]
|
|
77
77
|
pythonhere = [
|
|
78
|
+
".agents/skills/pythonhere/SKILL.md",
|
|
79
|
+
".agents/skills/pythonhere/agents/openai.yaml",
|
|
80
|
+
".agents/skills/pythonhere/references/*.md",
|
|
78
81
|
"*.kv",
|
|
79
82
|
"data/logo/*.png",
|
|
80
83
|
"magic_here/prompts/*.md",
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pythonhere
|
|
3
|
+
description: "Build, inspect, and debug PythonHere applications by executing Python through the `there` CLI in an already-running Kivy/Python-for-Android process. Use when a task targets a PythonHere device or `there.env` connection and involves live Kivy UI, KV language, Android APIs, Pyjnius, permissions, installed Android packages, media/files, Plyer device features, BLE with able, or MIDI with midistream."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Operate PythonHere with `there`
|
|
7
|
+
|
|
8
|
+
Treat the target as a live Android/Kivy application. Use the installed `there`
|
|
9
|
+
CLI for transport and execution. Consult the `there-cli` skill when the task
|
|
10
|
+
needs connection discovery, unfamiliar or version-sensitive syntax, transfers,
|
|
11
|
+
timeout or failure diagnosis, or its fuller remote-execution safety guidance.
|
|
12
|
+
For routine `ping`, `get`, `logs`, or `run` calls whose invocation is already
|
|
13
|
+
established, use the common workflow below without loading `there-cli` solely
|
|
14
|
+
because it is the transport.
|
|
15
|
+
|
|
16
|
+
## Load the relevant runtime rules
|
|
17
|
+
|
|
18
|
+
The common runtime contract and guardrails are in this file. Consult a reference
|
|
19
|
+
only when the task needs its additional detail and that detail is not already
|
|
20
|
+
available in the current context. Do not reopen a reference merely because the
|
|
21
|
+
request mentions its topic. Read the applicable sections, or the complete file
|
|
22
|
+
when the task depends on it broadly or requires its exact current contents.
|
|
23
|
+
|
|
24
|
+
- Consult [kivy-runtime.md](references/kivy-runtime.md) for nontrivial Kivy
|
|
25
|
+
runtime, lifecycle, threading, state, or UI-construction details beyond the
|
|
26
|
+
guardrails below. A simple property change does not require it.
|
|
27
|
+
- Consult [kivy-kv.md](references/kivy-kv.md) for nontrivial KV generation or
|
|
28
|
+
modification details.
|
|
29
|
+
- Consult [android-runtime.md](references/android-runtime.md) for Android
|
|
30
|
+
activity, service, context, or lifecycle details.
|
|
31
|
+
- Consult [jnius.md](references/jnius.md) for Java/Android API calls through
|
|
32
|
+
Pyjnius.
|
|
33
|
+
- Consult [android-permissions.md](references/android-permissions.md) for
|
|
34
|
+
permission checks or requests.
|
|
35
|
+
- Consult [android-packages.md](references/android-packages.md) for installed
|
|
36
|
+
applications or package metadata.
|
|
37
|
+
- Consult [android-media.md](references/android-media.md) for shared storage,
|
|
38
|
+
MediaStore, images, video, downloads, or galleries.
|
|
39
|
+
- Consult [plyer.md](references/plyer.md) for notifications, vibration, TTS,
|
|
40
|
+
recording, camera, file selection, GPS, battery, or sensors.
|
|
41
|
+
- Consult [able.md](references/able.md) for Bluetooth Low Energy work.
|
|
42
|
+
- Consult [midi.md](references/midi.md) for MIDI or synthesizer work.
|
|
43
|
+
|
|
44
|
+
Combine references when a feature genuinely needs details from several
|
|
45
|
+
concerns; for example, an Android gallery may need permission, MediaStore, and
|
|
46
|
+
Pyjnius guidance. Do not load every potentially related reference in advance.
|
|
47
|
+
|
|
48
|
+
## Use the shared runtime tools
|
|
49
|
+
|
|
50
|
+
PythonHere provides general helpers in `tools_here`; they are available to
|
|
51
|
+
Jupyter commands, agents, and arbitrary code executed in the live runtime.
|
|
52
|
+
They complement rather than restrict normal Python:
|
|
53
|
+
|
|
54
|
+
- `snapshot_ui(widget=None, max_depth=6, max_widgets=200,
|
|
55
|
+
widget_record_callback=None)` returns a bounded, JSON-compatible diagnostic
|
|
56
|
+
snapshot. It reports observable widget paths, classes, text, original text
|
|
57
|
+
length, disabled state, geometry, and child counts. It does not infer KV `id`
|
|
58
|
+
ownership. Lower the soft limits for a narrow inspection; hard ceilings
|
|
59
|
+
prevent more than 48 levels or 500 widgets.
|
|
60
|
+
- `runtime_info(app=None, root=None)` returns compact Kivy runtime information.
|
|
61
|
+
- `save_screenshot(path="pythonhere-screenshot.png", widget=None)` writes a PNG.
|
|
62
|
+
Relative paths are rooted in the PythonHere upload/SFTP directory.
|
|
63
|
+
- `encoded_screenshot(widget=None)` returns the visible content as base64 PNG.
|
|
64
|
+
- `pin_shortcut(script, label=None)` requests an Android launcher shortcut.
|
|
65
|
+
|
|
66
|
+
These helpers may be called on Kivy's main thread or from a worker. Worker calls
|
|
67
|
+
are transparently marshaled to Kivy's thread and block that worker until Kivy
|
|
68
|
+
finishes the operation, normally on its next frame. Continue to prefer normal
|
|
69
|
+
foreground `there get` and `there run` for quick UI operations. Add `--worker`
|
|
70
|
+
to `get` or `run` when surrounding slow or blocking work would otherwise block
|
|
71
|
+
the UI. The CLI remains attached, waits for completion, and then returns the
|
|
72
|
+
value or captured output. Worker execution does not make other Kivy access
|
|
73
|
+
thread-safe.
|
|
74
|
+
|
|
75
|
+
Do not call a worker-marshaled helper while Kivy's main thread is synchronously
|
|
76
|
+
waiting for that same worker. Neither side can progress in that cross-thread
|
|
77
|
+
wait. A bridge timeout prevents an indefinite wait, but a mutation that already
|
|
78
|
+
started may still complete and must not be retried blindly.
|
|
79
|
+
|
|
80
|
+
Inspect the UI directly with an expression:
|
|
81
|
+
|
|
82
|
+
```console
|
|
83
|
+
there --json get "__import__('tools_here').snapshot_ui(root)"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The returned value has this shape:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"widgets": [
|
|
91
|
+
{
|
|
92
|
+
"path": "0/2/1",
|
|
93
|
+
"class": "Button",
|
|
94
|
+
"text": "Expand all",
|
|
95
|
+
"text_length": 10,
|
|
96
|
+
"disabled": false,
|
|
97
|
+
"pos": [16.0, 520.0],
|
|
98
|
+
"size": [180.0, 46.0],
|
|
99
|
+
"child_count": 0
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"widget_count": 12,
|
|
103
|
+
"truncated": false
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Treat `path` as structural and local to that snapshot. Do not use it as a
|
|
108
|
+
persistent widget selector: the path can change whenever the widget tree
|
|
109
|
+
changes. When `truncated` is true and the missing portion matters, rerun with
|
|
110
|
+
higher soft limits up to `max_depth=48` and `max_widgets=500`. Filter the
|
|
111
|
+
returned JSON locally or use arbitrary remote Python for more specific
|
|
112
|
+
inspection.
|
|
113
|
+
|
|
114
|
+
After mounting or changing UI, inspect in a subsequent `there` request or after
|
|
115
|
+
one Kivy frame; earlier geometry may still be pre-layout.
|
|
116
|
+
|
|
117
|
+
For application-specific state, pass `widget_record_callback`. It receives each
|
|
118
|
+
live widget and its default record on Kivy's main thread. It may mutate and
|
|
119
|
+
return that record, return a replacement dictionary, or return `None` to omit
|
|
120
|
+
the record without pruning its children:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
def inspect_widget(widget, record):
|
|
124
|
+
if hasattr(widget, "value"):
|
|
125
|
+
record["value"] = widget.value
|
|
126
|
+
return record
|
|
127
|
+
|
|
128
|
+
snapshot = snapshot_ui(root, widget_record_callback=inspect_widget)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For enrichment or redaction, prefer mutating and returning the provided record.
|
|
132
|
+
Return a replacement dictionary only when intentionally creating a reduced
|
|
133
|
+
custom schema.
|
|
134
|
+
|
|
135
|
+
The callback may similarly add `str(widget.text)` under a custom `full_text`
|
|
136
|
+
field when untruncated text is explicitly needed. Keep the callback fast and
|
|
137
|
+
nonblocking: do not sleep, perform I/O, wait for threads, mutate the widget
|
|
138
|
+
tree, or start a Kivy event loop. Returned records and all nested values must be
|
|
139
|
+
JSON-compatible. A callback exception or invalid result preserves that widget's
|
|
140
|
+
default record and adds a compact `inspection_error`; inspection then continues
|
|
141
|
+
with later widgets. Omitted records still count toward `max_widgets`.
|
|
142
|
+
|
|
143
|
+
Inspect compact runtime metadata when diagnosing the target:
|
|
144
|
+
|
|
145
|
+
```console
|
|
146
|
+
there --json get "__import__('tools_here').runtime_info(app, root)"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
For a screenshot, execute the helper, retrieve the artifact, then inspect the
|
|
150
|
+
local image:
|
|
151
|
+
|
|
152
|
+
```console
|
|
153
|
+
there --json run --code "from tools_here import save_screenshot; pythonhere_screenshot = save_screenshot('pythonhere-agent-screenshot.png', root)"
|
|
154
|
+
there --json download pythonhere-agent-screenshot.png ./pythonhere-agent-screenshot.png
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Use `pin_shortcut` only when the user explicitly asks to add a launcher
|
|
158
|
+
shortcut. Upload the referenced script first and remember that Android may show
|
|
159
|
+
a launcher confirmation:
|
|
160
|
+
|
|
161
|
+
```console
|
|
162
|
+
there --json upload ./demo.py
|
|
163
|
+
there --json run --code "from tools_here import pin_shortcut; pin_shortcut('demo.py', 'Demo')"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Workflow
|
|
167
|
+
|
|
168
|
+
1. Establish the installed CLI interface and target using the `there-cli`
|
|
169
|
+
workflow. Prefer JSON mode and start with `there --json ping` when target
|
|
170
|
+
readiness is not already established.
|
|
171
|
+
2. Inspect only the state needed for the task. Prefer small `there --json get`
|
|
172
|
+
expressions for named globals or compact summaries, and `there --json logs`
|
|
173
|
+
for diagnostics. Use `tools_here` inspection or screenshots when structure or
|
|
174
|
+
rendering matters. Remember that `get` evaluates code and is not inherently
|
|
175
|
+
read-only.
|
|
176
|
+
3. Design for the live runtime:
|
|
177
|
+
- Assume the Kivy event loop is already running.
|
|
178
|
+
- Assume `app` and the visible `root` container already exist.
|
|
179
|
+
- Preserve useful objects in clearly named globals so later commands can
|
|
180
|
+
inspect, reuse, stop, or release them.
|
|
181
|
+
- Keep callbacks non-blocking and marshal UI changes to the Kivy thread.
|
|
182
|
+
4. For more than a short expression, create a local UTF-8 Python file and run it
|
|
183
|
+
with `there --json run FILE`. Prefer a file over fragile shell quoting or a
|
|
184
|
+
long `--code` value. Keep within the installed CLI's input limit. Add
|
|
185
|
+
`--worker` for slow or blocking code that should not occupy Kivy's main
|
|
186
|
+
thread.
|
|
187
|
+
5. Make only the requested live-app mutation. Reuse existing state when
|
|
188
|
+
practical and provide cleanup helpers for scheduled events, sensors,
|
|
189
|
+
Bluetooth, MIDI, files, or other held resources.
|
|
190
|
+
6. Verify with the narrowest useful observation:
|
|
191
|
+
- inspect a named result/status global with `there --json get`;
|
|
192
|
+
- retrieve relevant recent logs;
|
|
193
|
+
- or inspect the specific widget/state changed.
|
|
194
|
+
Check `ok`, `error`, exit status, and truncation fields before declaring
|
|
195
|
+
success.
|
|
196
|
+
|
|
197
|
+
## Live-app guardrails
|
|
198
|
+
|
|
199
|
+
- Do not generate a standalone Kivy application or start/stop an event loop.
|
|
200
|
+
- Do not use ADB or local host Android tooling to operate the remote app.
|
|
201
|
+
- Do not replace the visible UI unless the user asks. When replacement is
|
|
202
|
+
requested, update the existing `root` container according to the Kivy
|
|
203
|
+
references.
|
|
204
|
+
- Do not block the main thread with sleeps, polling loops, network calls, media
|
|
205
|
+
decoding, or long computation.
|
|
206
|
+
- Do not rely on callback `print` output. Store callback results/errors in named
|
|
207
|
+
globals and use visible UI status when user feedback is needed.
|
|
208
|
+
- Do not blindly retry after an ambiguous mutating failure. Inspect state first
|
|
209
|
+
because the code may already have run.
|
|
210
|
+
- Treat permissions, sensors, camera, microphone, location, private files, and
|
|
211
|
+
remote shell execution as capability-sensitive operations. Request or access
|
|
212
|
+
only what the task requires.
|
|
213
|
+
- Preserve the running app after expected failures: log the exception, store a
|
|
214
|
+
compact error, and show a useful UI error where appropriate.
|
|
215
|
+
|
|
216
|
+
## Examples
|
|
217
|
+
|
|
218
|
+
Inspect the current live root without dumping the widget tree:
|
|
219
|
+
|
|
220
|
+
```console
|
|
221
|
+
there --json get "(type(root).__name__, len(root.children))"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Run a prepared UI change:
|
|
225
|
+
|
|
226
|
+
```console
|
|
227
|
+
there --json run /tmp/pythonhere-ui.py
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Run slow or blocking non-UI work without freezing Kivy, while waiting for its
|
|
231
|
+
buffered output:
|
|
232
|
+
|
|
233
|
+
```console
|
|
234
|
+
there --json run --worker /tmp/pythonhere-long-task.py
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Verify a named status left by that code:
|
|
238
|
+
|
|
239
|
+
```console
|
|
240
|
+
there --json get "pythonhere_feature_status"
|
|
241
|
+
```
|