pythonnative 0.22.1__tar.gz → 0.24.0__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 (163) hide show
  1. {pythonnative-0.22.1/src/pythonnative.egg-info → pythonnative-0.24.0}/PKG-INFO +5 -4
  2. {pythonnative-0.22.1 → pythonnative-0.24.0}/README.md +4 -3
  3. {pythonnative-0.22.1 → pythonnative-0.24.0}/pyproject.toml +1 -3
  4. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/__init__.py +43 -50
  5. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/animated.py +1 -1
  6. pythonnative-0.24.0/src/pythonnative/appearance.py +124 -0
  7. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/cli/pn.py +3 -3
  8. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/components.py +873 -466
  9. pythonnative-0.24.0/src/pythonnative/diagnostics.py +214 -0
  10. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/element.py +5 -2
  11. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/events.py +13 -8
  12. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/hooks.py +454 -49
  13. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/hot_reload.py +9 -1
  14. pythonnative-0.24.0/src/pythonnative/images.py +196 -0
  15. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/mutations.py +3 -12
  16. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_views/__init__.py +1 -7
  17. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_views/android.py +651 -46
  18. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_views/desktop.py +116 -20
  19. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_views/ios.py +974 -52
  20. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/navigation.py +41 -17
  21. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/preview.py +74 -7
  22. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/config.py +1 -9
  23. pythonnative-0.24.0/src/pythonnative/reconciler.py +1789 -0
  24. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/screen.py +409 -27
  25. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/storage.py +3 -3
  26. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/style.py +148 -6
  27. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/AndroidManifest.xml +2 -1
  28. pythonnative-0.24.0/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNAccessibilityDelegate.kt +47 -0
  29. pythonnative-0.24.0/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNBorderDrawable.kt +67 -0
  30. pythonnative-0.24.0/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNVirtualListView.java +172 -0
  31. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/ScreenFragment.kt +22 -0
  32. pythonnative-0.24.0/src/pythonnative/virtual_rows.py +137 -0
  33. {pythonnative-0.22.1 → pythonnative-0.24.0/src/pythonnative.egg-info}/PKG-INFO +5 -4
  34. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative.egg-info/SOURCES.txt +11 -0
  35. pythonnative-0.24.0/tests/test_appearance.py +181 -0
  36. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_components.py +135 -5
  37. pythonnative-0.24.0/tests/test_core_semantics.py +827 -0
  38. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_desktop_backend.py +6 -5
  39. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_hooks.py +12 -13
  40. pythonnative-0.24.0/tests/test_images.py +145 -0
  41. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_metric_hooks.py +49 -0
  42. pythonnative-0.24.0/tests/test_native_lists.py +329 -0
  43. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_native_views.py +3 -8
  44. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_navigation.py +4 -4
  45. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_new_components.py +47 -7
  46. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_reconciler.py +10 -10
  47. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_ref.py +41 -27
  48. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_screen.py +67 -0
  49. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_style.py +6 -4
  50. pythonnative-0.22.1/src/pythonnative/reconciler.py +0 -1367
  51. {pythonnative-0.22.1 → pythonnative-0.24.0}/LICENSE +0 -0
  52. {pythonnative-0.22.1 → pythonnative-0.24.0}/setup.cfg +0 -0
  53. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/_ios_log.py +0 -0
  54. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/alerts.py +0 -0
  55. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/cli/__init__.py +0 -0
  56. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/gestures.py +0 -0
  57. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/layout.py +0 -0
  58. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/__init__.py +0 -0
  59. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/app_state.py +0 -0
  60. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/battery.py +0 -0
  61. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/biometrics.py +0 -0
  62. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/camera.py +0 -0
  63. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/clipboard.py +0 -0
  64. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/file_system.py +0 -0
  65. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/haptics.py +0 -0
  66. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/linking.py +0 -0
  67. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/location.py +0 -0
  68. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/net_info.py +0 -0
  69. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/notifications.py +0 -0
  70. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/permissions.py +0 -0
  71. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/secure_store.py +0 -0
  72. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_modules/share.py +0 -0
  73. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/native_views/base.py +0 -0
  74. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/net.py +0 -0
  75. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/platform.py +0 -0
  76. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/platform_metrics.py +0 -0
  77. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/__init__.py +0 -0
  78. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/android.py +0 -0
  79. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/builder.py +0 -0
  80. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/doctor.py +0 -0
  81. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/icons.py +0 -0
  82. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/ios.py +0 -0
  83. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/permissions.py +0 -0
  84. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/project/runtime_assets.py +0 -0
  85. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/runtime.py +0 -0
  86. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/sdk/__init__.py +0 -0
  87. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/sdk/_components.py +0 -0
  88. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/build.gradle +0 -0
  89. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/proguard-rules.pro +0 -0
  90. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/androidTest/java/com/pythonnative/android_template/ExampleInstrumentedTest.kt +0 -0
  91. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/MainActivity.kt +0 -0
  92. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/Navigator.kt +0 -0
  93. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/drawable/ic_launcher_background.xml +0 -0
  94. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -0
  95. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/layout/activity_main.xml +0 -0
  96. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -0
  97. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -0
  98. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  99. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  100. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  101. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  102. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  103. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  104. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  105. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  106. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  107. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  108. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/navigation/nav_graph.xml +0 -0
  109. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/colors.xml +0 -0
  110. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/strings.xml +0 -0
  111. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/themes.xml +0 -0
  112. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values-night/themes.xml +0 -0
  113. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/xml/backup_rules.xml +0 -0
  114. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/xml/data_extraction_rules.xml +0 -0
  115. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/test/java/com/pythonnative/android_template/ExampleUnitTest.kt +0 -0
  116. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/build.gradle +0 -0
  117. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.jar +0 -0
  118. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.properties +0 -0
  119. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle.properties +0 -0
  120. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradlew +0 -0
  121. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradlew.bat +0 -0
  122. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/settings.gradle +0 -0
  123. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/AppDelegate.swift +0 -0
  124. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/AccentColor.colorset/Contents.json +0 -0
  125. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
  126. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/Contents.json +0 -0
  127. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Base.lproj/LaunchScreen.storyboard +0 -0
  128. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Base.lproj/Main.storyboard +0 -0
  129. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Info.plist +0 -0
  130. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/SceneDelegate.swift +0 -0
  131. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/ViewController.swift +0 -0
  132. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template.xcodeproj/project.pbxproj +0 -0
  133. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  134. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateTests/ios_templateTests.swift +0 -0
  135. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITests.swift +0 -0
  136. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITestsLaunchTests.swift +0 -0
  137. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative/utils.py +0 -0
  138. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative.egg-info/dependency_links.txt +0 -0
  139. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative.egg-info/entry_points.txt +0 -0
  140. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative.egg-info/requires.txt +0 -0
  141. {pythonnative-0.22.1 → pythonnative-0.24.0}/src/pythonnative.egg-info/top_level.txt +0 -0
  142. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_alert.py +0 -0
  143. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_animated.py +0 -0
  144. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_async_hooks.py +0 -0
  145. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_cli.py +0 -0
  146. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_element.py +0 -0
  147. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_events.py +0 -0
  148. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_extended_components.py +0 -0
  149. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_gestures.py +0 -0
  150. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_hot_reload.py +0 -0
  151. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_incremental_render.py +0 -0
  152. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_ios_log.py +0 -0
  153. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_layout.py +0 -0
  154. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_mutations.py +0 -0
  155. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_native_modules.py +0 -0
  156. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_net.py +0 -0
  157. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_platform.py +0 -0
  158. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_platform_metrics.py +0 -0
  159. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_runtime.py +0 -0
  160. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_sdk.py +0 -0
  161. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_smoke.py +0 -0
  162. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_storage.py +0 -0
  163. {pythonnative-0.22.1 → pythonnative-0.24.0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythonnative
3
- Version: 0.22.1
3
+ Version: 0.24.0
4
4
  Summary: Cross-platform native UI toolkit for Android and iOS
5
5
  Author: Owen Carey
6
6
  License: MIT License
@@ -104,7 +104,8 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
104
104
  - **Declarative UI:** Describe *what* your UI should look like with element functions (`Text`, `Button`, `Column`, `Row`, etc.). PythonNative creates and updates native views automatically.
105
105
  - **Rich component library:** 25+ built-in components backed by real native widgets: `TextInput`, `Image` / `ImageBackground`, `ScrollView`, `FlatList` / `SectionList`, `Modal`, `Pressable` / `TouchableOpacity`, `Switch` / `Checkbox`, `Slider`, `SegmentedControl`, `Picker`, `DatePicker`, `ProgressBar` / `ActivityIndicator`, `WebView`, and more.
106
106
  - **Device APIs:** Cross-platform modules for `Camera`, `Location`, `FileSystem`, `Notifications`, `Clipboard`, `Share`, `Linking`, `Permissions`, `AppState`, `NetInfo`, `SecureStore`, `Battery`, `Haptics` / `Vibration`, and `Biometrics`, plus reactive `use_app_state` and `use_net_info` hooks.
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.
107
+ - **Hooks and function components:** Manage state with `use_state`, side effects with `use_effect` / `use_layout_effect`, refs and imperative handles with `use_ref` / `use_imperative_handle`, and navigation with `use_navigation`, all through one consistent pattern. Components can return a single element, a list of siblings, or `None`, and `Fragment`, `Portal`, and reactive `Provider` context work the way they do in React.
108
+ - **Developer feedback that finds your bugs:** In dev mode (`pn preview`, hot reload, or `PN_DEV=1`), uncaught errors from renders, effects, and event handlers show a full-screen RedBox with the traceback; unknown style keys and duplicate list keys print "did you mean" warnings; and conditional hooks raise a `HookOrderError` at the source instead of silently cross-wiring state.
108
109
  - **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`.
109
110
  - **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.
110
111
  - **Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation. Each commit lands as **one batched transaction** of mutation ops, and event callbacks are routed through a tag-based registry so re-renders that only change closures cost zero native calls. 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.
@@ -115,7 +116,7 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
115
116
  - **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.
116
117
  - **CLI scaffolding:** `pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
117
118
  - **Instant desktop preview:** `pn preview` renders your app in a native desktop window via Tkinter with Fast Refresh on every save: iterate on layout, state, and navigation in milliseconds without booting a simulator or device. The reconciler, hooks, layout engine, and navigation are the same code that ships to the phone.
118
- - **Native-backed navigation:** Declarative `Stack`, `Tab`, and `Drawer` navigators inspired by React Navigation. The root stack drives the platform's native navigation controller (`UINavigationController` on iOS, AndroidX Navigation Component on Android), so transitions, back gestures, and the hardware back button match what users expect.
119
+ - **Native-backed navigation:** Declarative `Stack`, `Tab`, and `Drawer` navigators inspired by React Navigation. The root stack drives the platform's native navigation controller (`UINavigationController` on iOS, AndroidX Navigation Component on Android), so transitions, back gestures, and the hardware back button match what users expect; `use_back_handler` intercepts the back action when a screen needs to.
119
120
  - **Fast Refresh hot reload:** `pn run --hot-reload` watches `app/` and patches edits into the running app on save, preserving component state across most changes.
120
121
  - **Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
121
122
 
@@ -140,7 +141,7 @@ def App():
140
141
  pn.Text(f"Count: {count}", style=pn.style(font_size=24, bold=True)),
141
142
  pn.Button(
142
143
  "Tap me",
143
- on_click=lambda: set_count(count + 1),
144
+ on_press=lambda: set_count(count + 1),
144
145
  ),
145
146
  style=pn.style(spacing=12, padding=16),
146
147
  )
@@ -33,7 +33,8 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
33
33
  - **Declarative UI:** Describe *what* your UI should look like with element functions (`Text`, `Button`, `Column`, `Row`, etc.). PythonNative creates and updates native views automatically.
34
34
  - **Rich component library:** 25+ built-in components backed by real native widgets: `TextInput`, `Image` / `ImageBackground`, `ScrollView`, `FlatList` / `SectionList`, `Modal`, `Pressable` / `TouchableOpacity`, `Switch` / `Checkbox`, `Slider`, `SegmentedControl`, `Picker`, `DatePicker`, `ProgressBar` / `ActivityIndicator`, `WebView`, and more.
35
35
  - **Device APIs:** Cross-platform modules for `Camera`, `Location`, `FileSystem`, `Notifications`, `Clipboard`, `Share`, `Linking`, `Permissions`, `AppState`, `NetInfo`, `SecureStore`, `Battery`, `Haptics` / `Vibration`, and `Biometrics`, plus reactive `use_app_state` and `use_net_info` hooks.
36
- - **Hooks and function components:** Manage state with `use_state`, side effects with `use_effect`, and navigation with `use_navigation`, all through one consistent pattern.
36
+ - **Hooks and function components:** Manage state with `use_state`, side effects with `use_effect` / `use_layout_effect`, refs and imperative handles with `use_ref` / `use_imperative_handle`, and navigation with `use_navigation`, all through one consistent pattern. Components can return a single element, a list of siblings, or `None`, and `Fragment`, `Portal`, and reactive `Provider` context work the way they do in React.
37
+ - **Developer feedback that finds your bugs:** In dev mode (`pn preview`, hot reload, or `PN_DEV=1`), uncaught errors from renders, effects, and event handlers show a full-screen RedBox with the traceback; unknown style keys and duplicate list keys print "did you mean" warnings; and conditional hooks raise a `HookOrderError` at the source instead of silently cross-wiring state.
37
38
  - **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`.
38
39
  - **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.
39
40
  - **Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation. Each commit lands as **one batched transaction** of mutation ops, and event callbacks are routed through a tag-based registry so re-renders that only change closures cost zero native calls. 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.
@@ -44,7 +45,7 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
44
45
  - **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.
45
46
  - **CLI scaffolding:** `pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
46
47
  - **Instant desktop preview:** `pn preview` renders your app in a native desktop window via Tkinter with Fast Refresh on every save: iterate on layout, state, and navigation in milliseconds without booting a simulator or device. The reconciler, hooks, layout engine, and navigation are the same code that ships to the phone.
47
- - **Native-backed navigation:** Declarative `Stack`, `Tab`, and `Drawer` navigators inspired by React Navigation. The root stack drives the platform's native navigation controller (`UINavigationController` on iOS, AndroidX Navigation Component on Android), so transitions, back gestures, and the hardware back button match what users expect.
48
+ - **Native-backed navigation:** Declarative `Stack`, `Tab`, and `Drawer` navigators inspired by React Navigation. The root stack drives the platform's native navigation controller (`UINavigationController` on iOS, AndroidX Navigation Component on Android), so transitions, back gestures, and the hardware back button match what users expect; `use_back_handler` intercepts the back action when a screen needs to.
48
49
  - **Fast Refresh hot reload:** `pn run --hot-reload` watches `app/` and patches edits into the running app on save, preserving component state across most changes.
49
50
  - **Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
50
51
 
@@ -69,7 +70,7 @@ def App():
69
70
  pn.Text(f"Count: {count}", style=pn.style(font_size=24, bold=True)),
70
71
  pn.Button(
71
72
  "Tap me",
72
- on_click=lambda: set_count(count + 1),
73
+ on_press=lambda: set_count(count + 1),
73
74
  ),
74
75
  style=pn.style(spacing=12, padding=16),
75
76
  )
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythonnative"
7
- version = "0.22.1"
7
+ version = "0.24.0"
8
8
  description = "Cross-platform native UI toolkit for Android and iOS"
9
9
  authors = [
10
10
  { name = "Owen Carey" }
@@ -98,8 +98,6 @@ pythonnative = [
98
98
  target-version = "py39"
99
99
  line-length = 120
100
100
  extend-exclude = [
101
- "experiments",
102
- "apps",
103
101
  "templates",
104
102
  "docs",
105
103
  ]
@@ -54,87 +54,72 @@ Example:
54
54
  count, set_count = pn.use_state(0)
55
55
  return pn.Column(
56
56
  pn.Text(f"Count: {count}", style=pn.style(font_size=24)),
57
- pn.Button("+", on_click=lambda: set_count(count + 1)),
57
+ pn.Button("+", on_press=lambda: set_count(count + 1)),
58
58
  style=pn.style(spacing=12),
59
59
  )
60
60
  ```
61
61
  """
62
62
 
63
- __version__ = "0.22.1"
63
+ __version__ = "0.24.0"
64
64
 
65
- from . import gestures, runtime, sdk
65
+ from . import appearance, diagnostics, gestures, images, runtime, sdk
66
66
  from .alerts import Alert
67
67
  from .animated import Animated, AnimatedValue, use_animated_value
68
68
  from .components import (
69
69
  ActivityIndicator,
70
- ActivityIndicatorProps,
71
70
  Button,
72
- ButtonProps,
73
71
  Checkbox,
74
- CheckboxProps,
75
72
  Column,
76
73
  DatePicker,
77
- DatePickerProps,
78
74
  ErrorBoundary,
79
75
  FlatList,
80
76
  Fragment,
81
77
  Image,
82
78
  ImageBackground,
83
- ImageBackgroundProps,
84
- ImageProps,
85
79
  KeyboardAvoidingView,
86
- KeyboardAvoidingViewProps,
80
+ ListController,
87
81
  Modal,
88
- ModalProps,
89
82
  Picker,
90
- PickerProps,
83
+ Portal,
91
84
  Pressable,
92
- PressableProps,
93
85
  ProgressBar,
94
- ProgressBarProps,
95
86
  RefreshControl,
96
87
  Row,
97
88
  SafeAreaView,
98
- SafeAreaViewProps,
99
89
  ScrollView,
100
- ScrollViewProps,
101
90
  SectionList,
102
91
  SegmentedControl,
103
- SegmentedControlProps,
104
92
  Slider,
105
- SliderProps,
106
93
  Spacer,
107
- SpacerProps,
108
94
  StatusBar,
109
- StatusBarProps,
110
95
  Switch,
111
- SwitchProps,
112
96
  Text,
113
97
  TextInput,
114
- TextInputProps,
115
- TextProps,
116
98
  TouchableOpacity,
117
- TouchableOpacityProps,
118
99
  View,
119
- ViewProps,
120
100
  WebView,
121
- WebViewProps,
122
101
  )
102
+ from .diagnostics import HookOrderError
123
103
  from .element import Element
124
104
  from .hooks import (
125
105
  MutationCall,
126
106
  MutationState,
127
107
  Provider,
128
108
  QueryResult,
109
+ Ref,
129
110
  batch_updates,
130
111
  component,
131
112
  create_context,
132
113
  memo,
133
114
  use_async_effect,
115
+ use_back_handler,
134
116
  use_callback,
117
+ use_color_scheme,
135
118
  use_context,
136
119
  use_effect,
120
+ use_imperative_handle,
137
121
  use_keyboard_height,
122
+ use_layout_effect,
138
123
  use_memo,
139
124
  use_mutation,
140
125
  use_navigation,
@@ -166,6 +151,7 @@ from .native_modules import (
166
151
  )
167
152
  from .navigation import (
168
153
  NavigationContainer,
154
+ ScreenOptions,
169
155
  create_drawer_navigator,
170
156
  create_stack_navigator,
171
157
  create_tab_navigator,
@@ -185,6 +171,10 @@ from .sdk import (
185
171
  )
186
172
  from .storage import AsyncStorage, use_persisted_state
187
173
  from .style import (
174
+ DEFAULT_DARK_THEME,
175
+ DEFAULT_LIGHT_THEME,
176
+ AccessibilityState,
177
+ AlignContent,
188
178
  AlignItems,
189
179
  AlignSelf,
190
180
  AutoCapitalize,
@@ -192,9 +182,11 @@ from .style import (
192
182
  Dimension,
193
183
  EdgeInsets,
194
184
  FlexDirection,
185
+ FlexWrap,
195
186
  FontWeight,
196
187
  JustifyContent,
197
188
  KeyboardType,
189
+ LayoutDirection,
198
190
  Overflow,
199
191
  Position,
200
192
  ReturnKeyType,
@@ -207,8 +199,10 @@ from .style import (
207
199
  TextDecoration,
208
200
  ThemeContext,
209
201
  TransformSpec,
202
+ default_theme,
210
203
  resolve_style,
211
204
  style,
205
+ use_theme,
212
206
  )
213
207
 
214
208
  __all__ = [
@@ -224,8 +218,10 @@ __all__ = [
224
218
  "Image",
225
219
  "ImageBackground",
226
220
  "KeyboardAvoidingView",
221
+ "ListController",
227
222
  "Modal",
228
223
  "Picker",
224
+ "Portal",
229
225
  "Pressable",
230
226
  "ProgressBar",
231
227
  "RefreshControl",
@@ -243,30 +239,6 @@ __all__ = [
243
239
  "TouchableOpacity",
244
240
  "View",
245
241
  "WebView",
246
- # Built-in Props dataclasses
247
- "ActivityIndicatorProps",
248
- "ButtonProps",
249
- "CheckboxProps",
250
- "DatePickerProps",
251
- "ImageBackgroundProps",
252
- "ImageProps",
253
- "KeyboardAvoidingViewProps",
254
- "ModalProps",
255
- "PickerProps",
256
- "PressableProps",
257
- "ProgressBarProps",
258
- "SafeAreaViewProps",
259
- "ScrollViewProps",
260
- "SegmentedControlProps",
261
- "SliderProps",
262
- "SpacerProps",
263
- "StatusBarProps",
264
- "SwitchProps",
265
- "TextInputProps",
266
- "TextProps",
267
- "TouchableOpacityProps",
268
- "ViewProps",
269
- "WebViewProps",
270
242
  # Core
271
243
  "Element",
272
244
  "create_screen",
@@ -278,12 +250,17 @@ __all__ = [
278
250
  "MutationCall",
279
251
  "MutationState",
280
252
  "QueryResult",
253
+ "Ref",
281
254
  "use_async_effect",
255
+ "use_back_handler",
282
256
  "use_callback",
257
+ "use_color_scheme",
283
258
  "use_context",
284
259
  "use_effect",
285
260
  "use_focus_effect",
261
+ "use_imperative_handle",
286
262
  "use_keyboard_height",
263
+ "use_layout_effect",
287
264
  "use_memo",
288
265
  "use_mutation",
289
266
  "use_navigation",
@@ -298,20 +275,27 @@ __all__ = [
298
275
  "Provider",
299
276
  # Navigation
300
277
  "NavigationContainer",
278
+ "ScreenOptions",
301
279
  "create_drawer_navigator",
302
280
  "create_stack_navigator",
303
281
  "create_tab_navigator",
304
282
  # Styling - typed primitives
283
+ "AccessibilityState",
284
+ "AlignContent",
305
285
  "AlignItems",
306
286
  "AlignSelf",
307
287
  "AutoCapitalize",
308
288
  "Color",
289
+ "DEFAULT_DARK_THEME",
290
+ "DEFAULT_LIGHT_THEME",
309
291
  "Dimension",
310
292
  "EdgeInsets",
311
293
  "FlexDirection",
294
+ "FlexWrap",
312
295
  "FontWeight",
313
296
  "JustifyContent",
314
297
  "KeyboardType",
298
+ "LayoutDirection",
315
299
  "Overflow",
316
300
  "Position",
317
301
  "ReturnKeyType",
@@ -324,8 +308,14 @@ __all__ = [
324
308
  "TextDecoration",
325
309
  "ThemeContext",
326
310
  "TransformSpec",
311
+ "default_theme",
327
312
  "resolve_style",
328
313
  "style",
314
+ "use_theme",
315
+ # Appearance
316
+ "appearance",
317
+ # Image pipeline
318
+ "images",
329
319
  # Animation
330
320
  "Animated",
331
321
  "AnimatedValue",
@@ -360,6 +350,9 @@ __all__ = [
360
350
  # Runtime
361
351
  "run_async",
362
352
  "runtime",
353
+ # Diagnostics
354
+ "HookOrderError",
355
+ "diagnostics",
363
356
  # Platform
364
357
  "Platform",
365
358
  # Custom-component SDK
@@ -834,7 +834,7 @@ def _make_animated_factory(
834
834
  ref = use_ref(None)
835
835
 
836
836
  def _attach_bindings() -> Callable[[], None]:
837
- tag = ref.get("_pn_tag")
837
+ tag = ref._pn_tag
838
838
  if tag is None:
839
839
  return lambda: None
840
840
  detachers = [value.attach(tag, _animated_prop_name(prop)) for prop, value in bindings.items()]
@@ -0,0 +1,124 @@
1
+ """System color-scheme (light / dark mode) tracking.
2
+
3
+ The platform screen host publishes the operating system's current
4
+ appearance here (Android: ``Configuration.uiMode``; iOS:
5
+ ``UITraitCollection.userInterfaceStyle``), and components read it back
6
+ through [`use_color_scheme`][pythonnative.use_color_scheme] or
7
+ [`use_theme`][pythonnative.use_theme], both of which re-render when
8
+ the scheme changes.
9
+
10
+ Apps can also *override* the scheme (e.g. an in-app appearance
11
+ setting) with [`set_color_scheme`][pythonnative.appearance.set_color_scheme];
12
+ the override wins over the system value until cleared with ``None``.
13
+
14
+ Example:
15
+ >>> from pythonnative import appearance
16
+ >>> appearance.get_color_scheme()
17
+ 'light'
18
+ >>> appearance.set_color_scheme("dark") # app-level override
19
+ >>> appearance.get_color_scheme()
20
+ 'dark'
21
+ >>> appearance.set_color_scheme(None) # follow the system again
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ import threading
27
+ from typing import Callable, List, Literal, Optional
28
+
29
+ ColorScheme = Literal["light", "dark"]
30
+ """The two supported appearance values."""
31
+
32
+ _system_scheme: str = "light"
33
+ _override_scheme: Optional[str] = None
34
+
35
+ _subscribers: List[Callable[[], None]] = []
36
+ _subscribers_lock = threading.Lock()
37
+
38
+
39
+ def _notify_subscribers() -> None:
40
+ """Invoke every registered subscriber, swallowing exceptions."""
41
+ with _subscribers_lock:
42
+ callbacks = list(_subscribers)
43
+ for cb in callbacks:
44
+ try:
45
+ cb()
46
+ except Exception:
47
+ pass
48
+
49
+
50
+ def subscribe(callback: Callable[[], None]) -> Callable[[], None]:
51
+ """Register ``callback`` to fire whenever the effective scheme changes.
52
+
53
+ Returns an unsubscribe function. Threadsafe.
54
+ """
55
+ with _subscribers_lock:
56
+ _subscribers.append(callback)
57
+
58
+ def _unsub() -> None:
59
+ with _subscribers_lock:
60
+ try:
61
+ _subscribers.remove(callback)
62
+ except ValueError:
63
+ pass
64
+
65
+ return _unsub
66
+
67
+
68
+ def _coerce(scheme: object) -> Optional[str]:
69
+ if scheme in ("light", "dark"):
70
+ return str(scheme)
71
+ return None
72
+
73
+
74
+ def set_system_color_scheme(scheme: str) -> None:
75
+ """Publish the operating system's current scheme.
76
+
77
+ Called by the platform screen host on create/resume and whenever
78
+ the system reports an appearance change. Invalid values are
79
+ ignored. Subscribers are only notified when the *effective* scheme
80
+ (after any app override) actually changes.
81
+ """
82
+ global _system_scheme
83
+ coerced = _coerce(scheme)
84
+ if coerced is None or coerced == _system_scheme:
85
+ return
86
+ effective_before = get_color_scheme()
87
+ _system_scheme = coerced
88
+ if get_color_scheme() != effective_before:
89
+ _notify_subscribers()
90
+
91
+
92
+ def set_color_scheme(scheme: Optional[str]) -> None:
93
+ """Set (or clear) the app-level scheme override.
94
+
95
+ Args:
96
+ scheme: ``"light"`` or ``"dark"`` to force that appearance
97
+ regardless of the system setting, or ``None`` to follow
98
+ the system again.
99
+ """
100
+ global _override_scheme
101
+ coerced = _coerce(scheme) if scheme is not None else None
102
+ if scheme is not None and coerced is None:
103
+ return
104
+ effective_before = get_color_scheme()
105
+ _override_scheme = coerced
106
+ if get_color_scheme() != effective_before:
107
+ _notify_subscribers()
108
+
109
+
110
+ def get_color_scheme() -> str:
111
+ """Return the effective scheme: the app override if set, else the system value."""
112
+ return _override_scheme if _override_scheme is not None else _system_scheme
113
+
114
+
115
+ def get_system_color_scheme() -> str:
116
+ """Return the system-reported scheme, ignoring any app override."""
117
+ return _system_scheme
118
+
119
+
120
+ def reset_color_scheme() -> None:
121
+ """Reset to system ``"light"`` with no override. Intended for tests."""
122
+ global _system_scheme, _override_scheme
123
+ _system_scheme = "light"
124
+ _override_scheme = None
@@ -59,8 +59,8 @@ def HomeScreen():
59
59
  pn.Column(
60
60
  pn.Text("Hello from PythonNative!", style={"font_size": 24, "bold": True}),
61
61
  pn.Text(f"Tapped {count} times"),
62
- pn.Button("Tap me", on_click=lambda: set_count(count + 1)),
63
- pn.Button("Open detail", on_click=lambda: nav.navigate("Detail", {"count": count})),
62
+ pn.Button("Tap me", on_press=lambda: set_count(count + 1)),
63
+ pn.Button("Open detail", on_press=lambda: nav.navigate("Detail", {"count": count})),
64
64
  style={"spacing": 12, "padding": 16, "align_items": "stretch"},
65
65
  )
66
66
  )
@@ -72,7 +72,7 @@ def DetailScreen():
72
72
  params = pn.use_route()
73
73
  return pn.Column(
74
74
  pn.Text(f"Detail: count was {params.get('count', 0)}", style={"font_size": 20}),
75
- pn.Button("Back", on_click=nav.go_back),
75
+ pn.Button("Back", on_press=nav.go_back),
76
76
  style={"spacing": 12, "padding": 16},
77
77
  )
78
78