pythonnative 0.19.0__py3-none-any.whl → 0.21.0__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.
- pythonnative/__init__.py +1 -1
- pythonnative/cli/pn.py +450 -956
- pythonnative/hooks.py +30 -6
- pythonnative/native_views/android.py +22 -2
- pythonnative/project/__init__.py +68 -0
- pythonnative/project/android.py +504 -0
- pythonnative/project/builder.py +555 -0
- pythonnative/project/config.py +642 -0
- pythonnative/project/doctor.py +233 -0
- pythonnative/project/icons.py +247 -0
- pythonnative/project/ios.py +344 -0
- pythonnative/project/permissions.py +343 -0
- pythonnative/project/runtime_assets.py +272 -0
- pythonnative/reconciler.py +285 -3
- pythonnative/screen.py +23 -27
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/METADATA +7 -2
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/RECORD +21 -12
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/WHEEL +0 -0
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/entry_points.txt +0 -0
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/licenses/LICENSE +0 -0
- {pythonnative-0.19.0.dist-info → pythonnative-0.21.0.dist-info}/top_level.txt +0 -0
pythonnative/screen.py
CHANGED
|
@@ -322,53 +322,49 @@ def _request_render(host: Any) -> None:
|
|
|
322
322
|
|
|
323
323
|
|
|
324
324
|
def _re_render(host: Any) -> None:
|
|
325
|
-
"""Run one render pass, then drain any renders queued during it.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
325
|
+
"""Run one *local* render pass, then drain any renders queued during it.
|
|
326
|
+
|
|
327
|
+
State setters mark only their own component subtree dirty (see
|
|
328
|
+
[`mark_dirty`][pythonnative.reconciler.Reconciler.mark_dirty]), so
|
|
329
|
+
this drains the reconciler's dirty set via
|
|
330
|
+
[`flush_dirty`][pythonnative.reconciler.Reconciler.flush_dirty]
|
|
331
|
+
instead of re-running the whole ``App`` from the root. The app's
|
|
332
|
+
element tree is only rebuilt from scratch on mount, navigation, and
|
|
333
|
+
hot reload.
|
|
334
|
+
"""
|
|
335
|
+
_log_pn("_re_render: starting local render pass")
|
|
329
336
|
host._is_rendering = True
|
|
330
337
|
try:
|
|
331
338
|
host._render_queued = False
|
|
332
|
-
|
|
333
|
-
app_element = _render_app(host)
|
|
334
|
-
provider_element = Provider(_NavigationContext, host._nav_handle, app_element)
|
|
335
|
-
|
|
336
|
-
new_root = host._reconciler.reconcile(provider_element)
|
|
337
|
-
if new_root is not host._root_native_view:
|
|
338
|
-
_log_pn(f"_re_render: ROOT VIEW CHANGED ({id(host._root_native_view)} -> {id(new_root)}); reattaching")
|
|
339
|
-
host._detach_root(host._root_native_view)
|
|
340
|
-
host._root_native_view = new_root
|
|
341
|
-
host._attach_root(new_root)
|
|
342
|
-
|
|
339
|
+
_commit_dirty(host)
|
|
343
340
|
_drain_renders(host)
|
|
344
341
|
finally:
|
|
345
342
|
host._is_rendering = False
|
|
346
343
|
_log_pn("_re_render: done")
|
|
347
344
|
|
|
348
345
|
|
|
346
|
+
def _commit_dirty(host: Any) -> None:
|
|
347
|
+
"""Flush the reconciler's dirty components and re-attach the root if it changed."""
|
|
348
|
+
new_root = host._reconciler.flush_dirty()
|
|
349
|
+
if new_root is not host._root_native_view:
|
|
350
|
+
_log_pn(f"_commit_dirty: ROOT VIEW CHANGED ({id(host._root_native_view)} -> {id(new_root)}); reattaching")
|
|
351
|
+
host._detach_root(host._root_native_view)
|
|
352
|
+
host._root_native_view = new_root
|
|
353
|
+
host._attach_root(new_root)
|
|
354
|
+
|
|
355
|
+
|
|
349
356
|
def _drain_renders(host: Any) -> None:
|
|
350
357
|
"""Flush additional renders queued by effects that set state.
|
|
351
358
|
|
|
352
359
|
Capped at `_MAX_RENDER_PASSES` to break runaway feedback loops
|
|
353
360
|
(e.g., an effect that unconditionally calls a setter).
|
|
354
361
|
"""
|
|
355
|
-
from .hooks import Provider, _NavigationContext
|
|
356
|
-
|
|
357
362
|
for i in range(_MAX_RENDER_PASSES):
|
|
358
363
|
if not host._render_queued:
|
|
359
364
|
break
|
|
360
365
|
_log_pn(f"_drain_renders: draining pass #{i + 1}")
|
|
361
366
|
host._render_queued = False
|
|
362
|
-
|
|
363
|
-
app_element = _render_app(host)
|
|
364
|
-
provider_element = Provider(_NavigationContext, host._nav_handle, app_element)
|
|
365
|
-
|
|
366
|
-
new_root = host._reconciler.reconcile(provider_element)
|
|
367
|
-
if new_root is not host._root_native_view:
|
|
368
|
-
_log_pn(f"_drain_renders: ROOT VIEW CHANGED ({id(host._root_native_view)} -> {id(new_root)}); reattaching")
|
|
369
|
-
host._detach_root(host._root_native_view)
|
|
370
|
-
host._root_native_view = new_root
|
|
371
|
-
host._attach_root(new_root)
|
|
367
|
+
_commit_dirty(host)
|
|
372
368
|
|
|
373
369
|
|
|
374
370
|
def _set_args(host: Any, args: Any) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythonnative
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: Cross-platform native UI toolkit for Android and iOS
|
|
5
5
|
Author: Owen Carey
|
|
6
6
|
License: MIT License
|
|
@@ -42,8 +42,11 @@ Requires-Python: >=3.10
|
|
|
42
42
|
Description-Content-Type: text/markdown
|
|
43
43
|
License-File: LICENSE
|
|
44
44
|
Requires-Dist: requests>=2.31.0
|
|
45
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
45
46
|
Provides-Extra: ios
|
|
46
47
|
Requires-Dist: rubicon-objc<0.5.0,>=0.4.6; extra == "ios"
|
|
48
|
+
Provides-Extra: build
|
|
49
|
+
Requires-Dist: Pillow>=10.0; extra == "build"
|
|
47
50
|
Provides-Extra: docs
|
|
48
51
|
Requires-Dist: mkdocs>=1.5; extra == "docs"
|
|
49
52
|
Requires-Dist: mkdocs-material[imaging]>=9.5; extra == "docs"
|
|
@@ -56,12 +59,14 @@ Requires-Dist: ruff>=0.5; extra == "dev"
|
|
|
56
59
|
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
57
60
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
58
61
|
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
62
|
+
Requires-Dist: Pillow>=10.0; extra == "dev"
|
|
59
63
|
Provides-Extra: ci
|
|
60
64
|
Requires-Dist: black>=24.0; extra == "ci"
|
|
61
65
|
Requires-Dist: ruff>=0.5; extra == "ci"
|
|
62
66
|
Requires-Dist: mypy>=1.10; extra == "ci"
|
|
63
67
|
Requires-Dist: pytest>=8.0; extra == "ci"
|
|
64
68
|
Requires-Dist: pytest-asyncio>=0.23; extra == "ci"
|
|
69
|
+
Requires-Dist: Pillow>=10.0; extra == "ci"
|
|
65
70
|
Dynamic: license-file
|
|
66
71
|
|
|
67
72
|
<p align="center">
|
|
@@ -102,7 +107,7 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
|
|
|
102
107
|
- **Hooks and function components:** Manage state with `use_state`, side effects with `use_effect`, and navigation with `use_navigation`, all through one consistent pattern.
|
|
103
108
|
- **Typed `style` prop:** Pass all visual and layout properties through a single `style` dict, fully described by the `pn.Style` `TypedDict` and the ergonomic `pn.style(...)` helper for IDE autocomplete and static checking. Compose reusable styles with `StyleSheet`.
|
|
104
109
|
- **Cross-platform flexbox engine:** A pure-Python, Yoga-style layout engine computes frames once and applies them to native views, so `flex`, `padding`, `aspect_ratio`, and `position: "absolute"` produce the same geometry on Android and iOS.
|
|
105
|
-
- **Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation.
|
|
110
|
+
- **Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation. State updates re-render **locally** — only the component whose state changed (and its subtree) re-runs, and unchanged leaves reuse cached intrinsic measurements — so deep UIs stay responsive instead of re-rendering the whole app from the root on every tap.
|
|
106
111
|
- **Direct native bindings:** Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge.
|
|
107
112
|
- **Custom-component SDK:** Wrap any platform widget as a first-class element with type-checked props via `pythonnative.sdk` (`Props`, `@native_component`, `element_factory`). Plugins distributed on PyPI auto-register through the `pythonnative.handlers` entry-point group.
|
|
108
113
|
- **CLI scaffolding:** `pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
pythonnative/__init__.py,sha256=
|
|
1
|
+
pythonnative/__init__.py,sha256=jhhtF52zr1ClcGivqtYTDjI2VmJ_Q2bbkZIDRgqP8g4,8042
|
|
2
2
|
pythonnative/_ios_log.py,sha256=Oi7V28VxcVoZyrpAirvLeEmUW18McqnU87V4d37Zzlw,2582
|
|
3
3
|
pythonnative/alerts.py,sha256=mIANysFlaHwL5EqKnvNcyiJN9rGiZi9XDrD9Jpz1RFM,9340
|
|
4
4
|
pythonnative/animated.py,sha256=bAgG_sGODAdl5eVQjX_vryaKI1hyjI92QH1PNx7Tqyg,24491
|
|
5
5
|
pythonnative/components.py,sha256=7vkoMaKVTVKZNBut1UKET3xawnJzuIc-Zt7m__3w9X8,72503
|
|
6
6
|
pythonnative/element.py,sha256=W9varJj0Cl9HpckL8BcsC1u4ryUQOPVMrvetro4ilAE,2725
|
|
7
|
-
pythonnative/hooks.py,sha256=
|
|
7
|
+
pythonnative/hooks.py,sha256=_XkoyK0aTqu3A7BiiXalN3R-qXTiOh1UbL_ZmUcIaDA,38996
|
|
8
8
|
pythonnative/hot_reload.py,sha256=j7z2c7o2Hdoyd-p4nQY15LTW7CBH_1z0TSAzLCer-aA,25036
|
|
9
9
|
pythonnative/layout.py,sha256=siU7PeVOjL_G1f-1q31ssrKWlxz2UBmvMwNXtmqyOxw,36586
|
|
10
10
|
pythonnative/navigation.py,sha256=skMZFh3AXEJgTU6qQpATFN1Lp4GB94K_ACNNXZjEOEE,35579
|
|
@@ -12,14 +12,14 @@ pythonnative/net.py,sha256=UI-39-BmGYWLE_vMAFoAbkzWZvfhIFj9yX_gexp1loc,8091
|
|
|
12
12
|
pythonnative/platform.py,sha256=cqG37hPY1fh6QzgO_AfHObg8R1fiMZmDeMu_2TIXqO0,4997
|
|
13
13
|
pythonnative/platform_metrics.py,sha256=m2u8M8x52n5THNsYdspcaI9mlWWMbfSJWai1svjD0NM,8976
|
|
14
14
|
pythonnative/preview.py,sha256=ZtDupXfQdW07i2JD-fnoikAd3zHKVPYoPSMob1K8KQs,16990
|
|
15
|
-
pythonnative/reconciler.py,sha256=
|
|
15
|
+
pythonnative/reconciler.py,sha256=cy6OtPXlxHzMafpNuMUfTMqIVobrxCnkwYd2MaiqOXw,56815
|
|
16
16
|
pythonnative/runtime.py,sha256=8xQvhZvMQJYJ0eozWTwKvC-H1GN5vikl6OCxt8f5uI0,18267
|
|
17
|
-
pythonnative/screen.py,sha256=
|
|
17
|
+
pythonnative/screen.py,sha256=Vm6tdc9YM9P1eORmEo-6clODeaTf6rF0aVFDgSxg6NE,64745
|
|
18
18
|
pythonnative/storage.py,sha256=hLgSI44ADq6wj29eeYbHaAUNpxYPzJ2ZLn1L7AHkPZY,12010
|
|
19
19
|
pythonnative/style.py,sha256=yDJv-G6iZIgrscpc-IZS_cbEQvY2o7R02PTQZ4BV8RA,15162
|
|
20
20
|
pythonnative/utils.py,sha256=-hwe_YS19ebpjeygdl3dGeVsYzO4G74rYD53svSi0rI,7593
|
|
21
21
|
pythonnative/cli/__init__.py,sha256=NM1psvKe8jT0vzp8Ak4MMoygZz4P_msk5g-YEsY8xLk,232
|
|
22
|
-
pythonnative/cli/pn.py,sha256=
|
|
22
|
+
pythonnative/cli/pn.py,sha256=dkFEQDV167j6s-AEsFHorjgaQ6XOW2y-yzz1SyBpE2E,28194
|
|
23
23
|
pythonnative/native_modules/__init__.py,sha256=pgigpHuzT-rqwcjlwJvu93_4L8Nozal1HJid0S_JlmM,2636
|
|
24
24
|
pythonnative/native_modules/app_state.py,sha256=EnfChi_YWEgUpZosUiBQh0CmblBZFw8ZGaW1NKIJ4WM,2666
|
|
25
25
|
pythonnative/native_modules/battery.py,sha256=gOU9aN5fCmWfHgTXPD-BgvatdQnyUjfVfsJM7PQ_ARA,4317
|
|
@@ -36,10 +36,19 @@ pythonnative/native_modules/permissions.py,sha256=adRiO_LGxZ1PSJaCoJx_3nheuh9lLW
|
|
|
36
36
|
pythonnative/native_modules/secure_store.py,sha256=YC25T2n2Nkfgks_qrCM1CR232AeSkh1_78NOJEBQ800,5956
|
|
37
37
|
pythonnative/native_modules/share.py,sha256=B9ovknmnjeQvGQ8MQ14Hmq6E1x-JA469APMburJ0KUg,4727
|
|
38
38
|
pythonnative/native_views/__init__.py,sha256=PCb2twVEIwEgMS5NZxsjoe4DeZwm1LRh0Q4QKYHS--A,12347
|
|
39
|
-
pythonnative/native_views/android.py,sha256=
|
|
39
|
+
pythonnative/native_views/android.py,sha256=nWwjK5BKo-ElYWbqSRFcTK-hJO6AFVJfmxYUncqfNWw,114739
|
|
40
40
|
pythonnative/native_views/base.py,sha256=LXDQYRM8wJa3MmGPwslkVyvlu36_s1_J6aO7wwhwYpA,6173
|
|
41
41
|
pythonnative/native_views/desktop.py,sha256=Z4r-72B3zbuvnqbJ5um35UqPM_iTj8wrEz61qcg0SZA,54931
|
|
42
42
|
pythonnative/native_views/ios.py,sha256=F-DTStyva9fsESHAR5qZkNwrQKH_q2BoSGzgKPKJCBA,142727
|
|
43
|
+
pythonnative/project/__init__.py,sha256=kAhWLONs53H1L7xVtczLmzYcQSOOkdRZTAJnIMhpBts,2064
|
|
44
|
+
pythonnative/project/android.py,sha256=fcYHXetZxzRRnPO_d6hj5jLWkAdQrZAS52nAh5bc9yk,19150
|
|
45
|
+
pythonnative/project/builder.py,sha256=ZubKkKy8NpdkCMypiRFAxDrvL2pgrFxF4TYBdp-ecnk,19098
|
|
46
|
+
pythonnative/project/config.py,sha256=BvBkeY0GB7PNRHnLzIoOGD3Fop-Fh248d_zoggm1WQc,24221
|
|
47
|
+
pythonnative/project/doctor.py,sha256=4z-IhalZ-SoSshgJHX7lEsDIrIlVeaOgR0CmiuDuJyk,7949
|
|
48
|
+
pythonnative/project/icons.py,sha256=edoi8RyztkoNJ_FIhkw6POGP2CIHA5Qg0AxLH3jiCGM,7948
|
|
49
|
+
pythonnative/project/ios.py,sha256=6-hCA6QT9sOXUSuAZryokS6HYGmOucn6qkxW_dNQFz8,14007
|
|
50
|
+
pythonnative/project/permissions.py,sha256=v4wGnfWMwnJ6U13KPKg9R9nq8Q4cDIIYFQ5QIVpMIXc,13236
|
|
51
|
+
pythonnative/project/runtime_assets.py,sha256=xX46O3-XKNlkOqEmWVudq55EsTtCUSXklHHX0G1wonQ,10168
|
|
43
52
|
pythonnative/sdk/__init__.py,sha256=btIRfW2yy2d2LzjdpFnlc6ym-G3iJj9sVUbb2IlFMOI,3384
|
|
44
53
|
pythonnative/sdk/_components.py,sha256=Hw0cqiyJ1NEzUrhOIT8zsC_mnVtf0jgpPUsireQG2qM,14644
|
|
45
54
|
pythonnative/templates/android_template/build.gradle,sha256=4gE6CRS6RuBu9kp-_e_uYYU9mBgHVZrqQg9caSxgyuc,352
|
|
@@ -94,9 +103,9 @@ pythonnative/templates/ios_template/ios_template.xcodeproj/project.xcworkspace/x
|
|
|
94
103
|
pythonnative/templates/ios_template/ios_templateTests/ios_templateTests.swift,sha256=YnwzZx7yXB13xKAXEGNgz17VuhWeqkHTRTtBJ2Vu3_E,1238
|
|
95
104
|
pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITests.swift,sha256=l2Pwa50F_rv-qPu2go6e4bQernM6PTQJeNPFl_c4ivY,1387
|
|
96
105
|
pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITestsLaunchTests.swift,sha256=f5JrG0uVtLMeJQy26Yyz7Om-JUkT220osqcbeIVkj2g,815
|
|
97
|
-
pythonnative-0.
|
|
98
|
-
pythonnative-0.
|
|
99
|
-
pythonnative-0.
|
|
100
|
-
pythonnative-0.
|
|
101
|
-
pythonnative-0.
|
|
102
|
-
pythonnative-0.
|
|
106
|
+
pythonnative-0.21.0.dist-info/licenses/LICENSE,sha256=A69iG7TIAe6KkGQf6xoVHkc5JSZtOr5eRSvC5iuivnI,1067
|
|
107
|
+
pythonnative-0.21.0.dist-info/METADATA,sha256=h6hd88KXCjIJyZqBrkRJzXfA6Mv5mbIvfian6qpvnfE,9439
|
|
108
|
+
pythonnative-0.21.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
109
|
+
pythonnative-0.21.0.dist-info/entry_points.txt,sha256=iUtDawWSAJAEyWTycpZxDuYz73ol31butpzDIEAgPO0,48
|
|
110
|
+
pythonnative-0.21.0.dist-info/top_level.txt,sha256=kT4SEATY2ywzrZ2Pgea6_zxyym44Q_PbOsUoOYjJLFE,13
|
|
111
|
+
pythonnative-0.21.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|