pythonhere 0.2.0__tar.gz → 0.2.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.
Files changed (64) hide show
  1. {pythonhere-0.2.0/pythonhere.egg-info → pythonhere-0.2.2}/PKG-INFO +8 -4
  2. {pythonhere-0.2.0 → pythonhere-0.2.2}/README.rst +6 -2
  3. {pythonhere-0.2.0 → pythonhere-0.2.2}/pyproject.toml +5 -2
  4. pythonhere-0.2.2/pythonhere/__init__.py +15 -0
  5. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/android_here.py +13 -6
  6. pythonhere-0.2.2/pythonhere/magic_here/prompts/README.md +49 -0
  7. pythonhere-0.2.2/pythonhere/magic_here/prompts/able.md +554 -0
  8. pythonhere-0.2.2/pythonhere/magic_here/prompts/android-media.md +130 -0
  9. pythonhere-0.2.2/pythonhere/magic_here/prompts/android-packages.md +69 -0
  10. pythonhere-0.2.2/pythonhere/magic_here/prompts/android-permissions.md +195 -0
  11. pythonhere-0.2.2/pythonhere/magic_here/prompts/android-runtime.md +34 -0
  12. pythonhere-0.2.2/pythonhere/magic_here/prompts/jnius.md +432 -0
  13. pythonhere-0.2.2/pythonhere/magic_here/prompts/kivy-kv.md +239 -0
  14. pythonhere-0.2.2/pythonhere/magic_here/prompts/kivy-runtime.md +306 -0
  15. pythonhere-0.2.2/pythonhere/magic_here/prompts/midi.md +243 -0
  16. pythonhere-0.2.2/pythonhere/magic_here/prompts/plyer.md +202 -0
  17. pythonhere-0.2.2/pythonhere/magic_here/prompts.py +37 -0
  18. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/main.py +9 -0
  19. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/server_here.py +1 -1
  20. pythonhere-0.2.2/pythonhere/version_here.py +1 -0
  21. {pythonhere-0.2.0 → pythonhere-0.2.2/pythonhere.egg-info}/PKG-INFO +8 -4
  22. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere.egg-info/SOURCES.txt +13 -0
  23. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere.egg-info/requires.txt +1 -1
  24. pythonhere-0.2.2/tests/test_ai_prompts.py +57 -0
  25. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_magic.py +8 -8
  26. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_main.py +32 -1
  27. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_server_here.py +1 -1
  28. pythonhere-0.2.0/pythonhere/__init__.py +0 -8
  29. pythonhere-0.2.0/pythonhere/version_here.py +0 -1
  30. {pythonhere-0.2.0 → pythonhere-0.2.2}/LICENSE +0 -0
  31. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/data/logo/logo-128.png +0 -0
  32. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/data/logo/logo-32.png +0 -0
  33. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/data/logo/logo-splash.png +0 -0
  34. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/enum_here.py +0 -0
  35. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/exception_manager_here.kv +0 -0
  36. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/exception_manager_here.py +0 -0
  37. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/launcher_here.py +0 -0
  38. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/magic_here/__init__.py +0 -0
  39. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/magic_here/shortcuts.py +0 -0
  40. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/network_here.py +0 -0
  41. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/patches_here.py +0 -0
  42. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/pythonhere.kv +0 -0
  43. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/__init__.py +0 -0
  44. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/actionbar_here.kv +0 -0
  45. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/common_here.kv +0 -0
  46. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/connection_address_here.kv +0 -0
  47. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/connection_address_here.py +0 -0
  48. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/layout_here.py +0 -0
  49. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/server_screen_here.kv +0 -0
  50. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/server_screen_here.py +0 -0
  51. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/settings_here.kv +0 -0
  52. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/ui_here/settings_here.py +0 -0
  53. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere/window_here.py +0 -0
  54. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere.egg-info/dependency_links.txt +0 -0
  55. {pythonhere-0.2.0 → pythonhere-0.2.2}/pythonhere.egg-info/top_level.txt +0 -0
  56. {pythonhere-0.2.0 → pythonhere-0.2.2}/setup.cfg +0 -0
  57. {pythonhere-0.2.0 → pythonhere-0.2.2}/setup.py +0 -0
  58. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_android_here.py +0 -0
  59. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_exception_manager_here.py +0 -0
  60. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_launcher_here.py +0 -0
  61. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_network.py +0 -0
  62. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_patches.py +0 -0
  63. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_settings.py +0 -0
  64. {pythonhere-0.2.0 → pythonhere-0.2.2}/tests/test_window_here.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonhere
3
- Version: 0.2.0
3
+ Version: 0.2.2
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.1.0
19
+ Requires-Dist: herethere[magic]>=0.2.3
20
20
  Requires-Dist: ipython
21
21
  Requires-Dist: ipywidgets
22
22
  Requires-Dist: Pillow
@@ -40,7 +40,7 @@ PythonHere
40
40
  :alt: Supported Python versions
41
41
  .. image:: https://github.com/b3b/pythonhere/actions/workflows/tests.yml/badge.svg?branch=master
42
42
  :target: https://github.com/b3b/pythonhere/actions/workflows/tests.yml?query=branch%3Amaster
43
- :alt: CI Status
43
+ :alt: CI Status
44
44
  .. image:: https://codecov.io/github/b3b/pythonhere/coverage.svg?branch=master
45
45
  :target: https://codecov.io/github/b3b/pythonhere?branch=master
46
46
  :alt: Code coverage Status
@@ -68,6 +68,9 @@ Project documentation: https://herethere.me/pythonhere
68
68
  Install the Android app
69
69
  -----------------------
70
70
 
71
+ Install *PythonHere* with `Obtainium <https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://github.com/b3b/pythonhere>`_
72
+ to receive updates from GitHub Releases.
73
+
71
74
  Ready-to-use *PythonHere* APKs are available from the `GitHub Releases <https://github.com/b3b/pythonhere/releases>`_ page.
72
75
 
73
76
  For APK provenance and signing checks, see `Android APK verification <https://github.com/b3b/pythonhere/blob/master/docs/android-apk-verification.rst>`_.
@@ -120,6 +123,7 @@ To build with `Buildozer <https://github.com/kivy/buildozer>`_, run in the sourc
120
123
  Related resources
121
124
  -----------------
122
125
 
123
- * `Kivy Remote Shell <https://github.com/kivy/kivy-remote-shell>`_ : Remote SSH+Python interactive shell application
124
126
  * `herethere <https://github.com/b3b/herethere>`_ : Library for interactive code execution, based on AsyncSSH
125
127
  * `AsyncSSH <https://github.com/ronf/asyncssh>`_ : Asynchronous SSH for Python
128
+ * `Buildozer <https://github.com/kivy/buildozer>`_ : Tool used to build the Android APK.
129
+ * `python-for-android <https://github.com/kivy/python-for-android>`_ : Build toolchain used by Buildozer to package Python applications for Android.
@@ -16,7 +16,7 @@ PythonHere
16
16
  :alt: Supported Python versions
17
17
  .. image:: https://github.com/b3b/pythonhere/actions/workflows/tests.yml/badge.svg?branch=master
18
18
  :target: https://github.com/b3b/pythonhere/actions/workflows/tests.yml?query=branch%3Amaster
19
- :alt: CI Status
19
+ :alt: CI Status
20
20
  .. image:: https://codecov.io/github/b3b/pythonhere/coverage.svg?branch=master
21
21
  :target: https://codecov.io/github/b3b/pythonhere?branch=master
22
22
  :alt: Code coverage Status
@@ -44,6 +44,9 @@ Project documentation: https://herethere.me/pythonhere
44
44
  Install the Android app
45
45
  -----------------------
46
46
 
47
+ Install *PythonHere* with `Obtainium <https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://github.com/b3b/pythonhere>`_
48
+ to receive updates from GitHub Releases.
49
+
47
50
  Ready-to-use *PythonHere* APKs are available from the `GitHub Releases <https://github.com/b3b/pythonhere/releases>`_ page.
48
51
 
49
52
  For APK provenance and signing checks, see `Android APK verification <https://github.com/b3b/pythonhere/blob/master/docs/android-apk-verification.rst>`_.
@@ -96,6 +99,7 @@ To build with `Buildozer <https://github.com/kivy/buildozer>`_, run in the sourc
96
99
  Related resources
97
100
  -----------------
98
101
 
99
- * `Kivy Remote Shell <https://github.com/kivy/kivy-remote-shell>`_ : Remote SSH+Python interactive shell application
100
102
  * `herethere <https://github.com/b3b/herethere>`_ : Library for interactive code execution, based on AsyncSSH
101
103
  * `AsyncSSH <https://github.com/ronf/asyncssh>`_ : Asynchronous SSH for Python
104
+ * `Buildozer <https://github.com/kivy/buildozer>`_ : Tool used to build the Android APK.
105
+ * `python-for-android <https://github.com/kivy/python-for-android>`_ : Build toolchain used by Buildozer to package Python applications for Android.
@@ -22,7 +22,7 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.14",
23
23
  ]
24
24
  dependencies = [
25
- "herethere[magic]>=0.1.0",
25
+ "herethere[magic]>=0.2.3",
26
26
  "ipython",
27
27
  "ipywidgets",
28
28
  "Pillow",
@@ -36,7 +36,6 @@ dev = [
36
36
  "docutils",
37
37
  "ifaddr",
38
38
  "kivy==2.3.1",
39
- "nest-asyncio2==1.7.2",
40
39
  "pylint",
41
40
  "pytest",
42
41
  "pytest-asyncio",
@@ -47,6 +46,8 @@ dev = [
47
46
  ]
48
47
  docker = [
49
48
  "jupytext==1.19.3",
49
+ "pandas",
50
+ "matplotlib",
50
51
  ]
51
52
 
52
53
  [project.urls]
@@ -60,6 +61,7 @@ environments = [
60
61
 
61
62
  [tool.pytest.ini_options]
62
63
  asyncio_mode = "auto"
64
+ pythonpath = ["pythonhere"]
63
65
 
64
66
  [tool.setuptools]
65
67
  packages = [
@@ -75,6 +77,7 @@ version = { attr = "pythonhere.version_here.__version__" }
75
77
  pythonhere = [
76
78
  "*.kv",
77
79
  "data/logo/*.png",
80
+ "magic_here/prompts/*.md",
78
81
  "ui_here/*.kv",
79
82
  ]
80
83
 
@@ -0,0 +1,15 @@
1
+ """PythonHere Jupyter magic."""
2
+
3
+ from herethere.magic import load_ipython_extension as load_herethere_extension
4
+
5
+ from .magic_here import shortcuts # noqa
6
+ from .magic_here.prompts import register_pythonhere_ai_prompts
7
+ from .version_here import __version__ # noqa
8
+
9
+ __all__ = ("load_ipython_extension",)
10
+
11
+
12
+ def load_ipython_extension(ipython):
13
+ """Hook for `%load_extension pythonhere`."""
14
+ register_pythonhere_ai_prompts()
15
+ load_herethere_extension(ipython)
@@ -22,7 +22,7 @@ def get_current_intent() -> Intent:
22
22
  return PythonActivity.mActivity.getIntent()
23
23
 
24
24
 
25
- def get_startup_script(intent: None = None) -> str | None:
25
+ def get_startup_script(intent: Intent | None = None) -> str | None:
26
26
  """Return script entrypoint that was passed to a given, or current, intent."""
27
27
  if not intent:
28
28
  intent = get_current_intent()
@@ -35,8 +35,7 @@ def restart_app(script: str = None):
35
35
  Logger.info("PythonHere: restart requested with a script: %s", script)
36
36
  activity = PythonActivity.mActivity
37
37
  intent = Intent(activity.getApplicationContext(), PythonActivity)
38
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
39
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
38
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK)
40
39
 
41
40
  if script:
42
41
  intent.setData(Uri.parse(script))
@@ -59,11 +58,17 @@ def bind_run_script_on_new_intent():
59
58
 
60
59
 
61
60
  def create_shortcut_icon() -> Icon:
62
- """Create icon to use for a shurtcut."""
61
+ """Create icon to use for a shortcut."""
63
62
  activity = PythonActivity.mActivity
64
- Drawable = autoclass(f"{activity.getPackageName()}.R$drawable")
65
63
  context = cast("android.content.Context", activity.getApplicationContext())
66
- return Icon.createWithResource(context, Drawable.icon)
64
+
65
+ app_info = context.getApplicationInfo()
66
+ icon_res_id = app_info.icon
67
+
68
+ if not icon_res_id:
69
+ raise RuntimeError("Application icon resource id was not found")
70
+
71
+ return Icon.createWithResource(context, icon_res_id)
67
72
 
68
73
 
69
74
  def resolve_script_path(script: str) -> str:
@@ -97,4 +102,6 @@ def pin_shortcut(script: str, label: str):
97
102
  )
98
103
 
99
104
  manager = activity.getSystemService(Context.SHORTCUT_SERVICE)
105
+ if not manager.isRequestPinShortcutSupported():
106
+ raise RuntimeError("Pinned shortcuts are not supported by this launcher")
100
107
  manager.requestPinShortcut(shortcut, None)
@@ -0,0 +1,49 @@
1
+ # PythonHere `%%there ai` prompts
2
+
3
+ These Markdown files are PythonHere-specific prompt sections for `%%there ai`.
4
+ They are registered when the `pythonhere` IPython extension is loaded.
5
+
6
+ The prompt sections describe the live PythonHere runtime: Kivy widgets,
7
+ Android/Python-for-Android APIs, Pyjnius, Plyer, runtime permissions, installed
8
+ packages, media access, BLE, and MIDI.
9
+
10
+ ## Active by default
11
+
12
+ Normal `%%there ai` requests use these PythonHere sections together with the
13
+ generic [`default`](https://github.com/b3b/herethere/blob/master/herethere/there/ai/prompts/default.md)
14
+ prompt from `herethere`:
15
+
16
+ - [`kivy-runtime`](kivy-runtime.md)
17
+ - [`kivy-kv`](kivy-kv.md)
18
+ - [`android-runtime`](android-runtime.md)
19
+ - [`jnius`](jnius.md)
20
+ - [`android-permissions`](android-permissions.md)
21
+ - [`android-packages`](android-packages.md)
22
+ - [`android-media`](android-media.md)
23
+ - [`plyer`](plyer.md)
24
+
25
+ ## Available on request
26
+
27
+ These sections are registered but not active by default. Add them with
28
+ `%%there ai --prompts ...` when a request needs that context:
29
+
30
+ - [`able`](able.md)
31
+ - [`midi`](midi.md)
32
+
33
+ Example:
34
+
35
+ ```python
36
+ %%there ai --prompts able
37
+ Build a small BLE scanner prototype.
38
+ ```
39
+
40
+ `%%there ai --fix` also uses the `herethere`
41
+ [`fix`](https://github.com/b3b/herethere/blob/master/herethere/there/ai/prompts/fix.md)
42
+ prompt section.
43
+
44
+ ## Custom prompts
45
+
46
+ Notebook-specific prompt sections can be added with
47
+ `herethere.there.ai.register_ai_prompt(...)`. Use custom prompts for visual
48
+ style, domain vocabulary, prototype conventions, or other context that should
49
+ not be part of the built-in PythonHere prompt stack.