pythonnative 0.23.0__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.
- {pythonnative-0.23.0/src/pythonnative.egg-info → pythonnative-0.24.0}/PKG-INFO +5 -4
- {pythonnative-0.23.0 → pythonnative-0.24.0}/README.md +4 -3
- {pythonnative-0.23.0 → pythonnative-0.24.0}/pyproject.toml +1 -1
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/__init__.py +29 -50
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/animated.py +1 -1
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/cli/pn.py +3 -3
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/components.py +250 -513
- pythonnative-0.24.0/src/pythonnative/diagnostics.py +214 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/element.py +5 -2
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/events.py +13 -8
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/hooks.py +413 -49
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/hot_reload.py +9 -1
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_views/android.py +78 -1
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_views/desktop.py +38 -1
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_views/ios.py +241 -7
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/navigation.py +41 -17
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/preview.py +43 -7
- pythonnative-0.24.0/src/pythonnative/reconciler.py +1789 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/screen.py +324 -27
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/storage.py +3 -3
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/style.py +83 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/ScreenFragment.kt +22 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0/src/pythonnative.egg-info}/PKG-INFO +5 -4
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative.egg-info/SOURCES.txt +2 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_components.py +5 -4
- pythonnative-0.24.0/tests/test_core_semantics.py +827 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_desktop_backend.py +6 -5
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_hooks.py +12 -13
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_native_lists.py +44 -7
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_navigation.py +4 -4
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_new_components.py +5 -5
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_reconciler.py +10 -10
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_ref.py +41 -27
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_screen.py +67 -0
- pythonnative-0.23.0/src/pythonnative/reconciler.py +0 -1367
- {pythonnative-0.23.0 → pythonnative-0.24.0}/LICENSE +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/setup.cfg +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/_ios_log.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/alerts.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/appearance.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/cli/__init__.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/gestures.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/images.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/layout.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/mutations.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/__init__.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/app_state.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/battery.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/biometrics.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/camera.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/clipboard.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/file_system.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/haptics.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/linking.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/location.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/net_info.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/notifications.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/permissions.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/secure_store.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_modules/share.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_views/__init__.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/native_views/base.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/net.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/platform.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/platform_metrics.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/__init__.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/android.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/builder.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/config.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/doctor.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/icons.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/ios.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/permissions.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/project/runtime_assets.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/runtime.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/sdk/__init__.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/sdk/_components.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/build.gradle +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/proguard-rules.pro +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/androidTest/java/com/pythonnative/android_template/ExampleInstrumentedTest.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/AndroidManifest.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/MainActivity.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/Navigator.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNAccessibilityDelegate.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNBorderDrawable.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/java/com/pythonnative/android_template/PNVirtualListView.java +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/drawable/ic_launcher_background.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/layout/activity_main.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/navigation/nav_graph.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/colors.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/strings.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values/themes.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/values-night/themes.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/xml/backup_rules.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/main/res/xml/data_extraction_rules.xml +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/app/src/test/java/com/pythonnative/android_template/ExampleUnitTest.kt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/build.gradle +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.jar +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle/wrapper/gradle-wrapper.properties +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradle.properties +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradlew +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/gradlew.bat +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/android_template/settings.gradle +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/AppDelegate.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/AccentColor.colorset/Contents.json +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Assets.xcassets/Contents.json +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Base.lproj/LaunchScreen.storyboard +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Base.lproj/Main.storyboard +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/Info.plist +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/SceneDelegate.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template/ViewController.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template.xcodeproj/project.pbxproj +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_template.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateTests/ios_templateTests.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITests.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/templates/ios_template/ios_templateUITests/ios_templateUITestsLaunchTests.swift +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/utils.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative/virtual_rows.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative.egg-info/dependency_links.txt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative.egg-info/entry_points.txt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative.egg-info/requires.txt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/src/pythonnative.egg-info/top_level.txt +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_alert.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_animated.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_appearance.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_async_hooks.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_cli.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_element.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_events.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_extended_components.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_gestures.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_hot_reload.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_images.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_incremental_render.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_ios_log.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_layout.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_metric_hooks.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_mutations.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_native_modules.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_native_views.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_net.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_platform.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_platform_metrics.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_runtime.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_sdk.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_smoke.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_storage.py +0 -0
- {pythonnative-0.23.0 → pythonnative-0.24.0}/tests/test_style.py +0 -0
- {pythonnative-0.23.0 → 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.
|
|
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
|
-
|
|
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
|
-
|
|
73
|
+
on_press=lambda: set_count(count + 1),
|
|
73
74
|
),
|
|
74
75
|
style=pn.style(spacing=12, padding=16),
|
|
75
76
|
)
|
|
@@ -54,88 +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("+",
|
|
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.
|
|
63
|
+
__version__ = "0.24.0"
|
|
64
64
|
|
|
65
|
-
from . import appearance, gestures, images, 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
|
-
|
|
80
|
+
ListController,
|
|
87
81
|
Modal,
|
|
88
|
-
ModalProps,
|
|
89
82
|
Picker,
|
|
90
|
-
|
|
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,
|
|
135
117
|
use_color_scheme,
|
|
136
118
|
use_context,
|
|
137
119
|
use_effect,
|
|
120
|
+
use_imperative_handle,
|
|
138
121
|
use_keyboard_height,
|
|
122
|
+
use_layout_effect,
|
|
139
123
|
use_memo,
|
|
140
124
|
use_mutation,
|
|
141
125
|
use_navigation,
|
|
@@ -167,6 +151,7 @@ from .native_modules import (
|
|
|
167
151
|
)
|
|
168
152
|
from .navigation import (
|
|
169
153
|
NavigationContainer,
|
|
154
|
+
ScreenOptions,
|
|
170
155
|
create_drawer_navigator,
|
|
171
156
|
create_stack_navigator,
|
|
172
157
|
create_tab_navigator,
|
|
@@ -188,6 +173,8 @@ from .storage import AsyncStorage, use_persisted_state
|
|
|
188
173
|
from .style import (
|
|
189
174
|
DEFAULT_DARK_THEME,
|
|
190
175
|
DEFAULT_LIGHT_THEME,
|
|
176
|
+
AccessibilityState,
|
|
177
|
+
AlignContent,
|
|
191
178
|
AlignItems,
|
|
192
179
|
AlignSelf,
|
|
193
180
|
AutoCapitalize,
|
|
@@ -195,9 +182,11 @@ from .style import (
|
|
|
195
182
|
Dimension,
|
|
196
183
|
EdgeInsets,
|
|
197
184
|
FlexDirection,
|
|
185
|
+
FlexWrap,
|
|
198
186
|
FontWeight,
|
|
199
187
|
JustifyContent,
|
|
200
188
|
KeyboardType,
|
|
189
|
+
LayoutDirection,
|
|
201
190
|
Overflow,
|
|
202
191
|
Position,
|
|
203
192
|
ReturnKeyType,
|
|
@@ -229,8 +218,10 @@ __all__ = [
|
|
|
229
218
|
"Image",
|
|
230
219
|
"ImageBackground",
|
|
231
220
|
"KeyboardAvoidingView",
|
|
221
|
+
"ListController",
|
|
232
222
|
"Modal",
|
|
233
223
|
"Picker",
|
|
224
|
+
"Portal",
|
|
234
225
|
"Pressable",
|
|
235
226
|
"ProgressBar",
|
|
236
227
|
"RefreshControl",
|
|
@@ -248,30 +239,6 @@ __all__ = [
|
|
|
248
239
|
"TouchableOpacity",
|
|
249
240
|
"View",
|
|
250
241
|
"WebView",
|
|
251
|
-
# Built-in Props dataclasses
|
|
252
|
-
"ActivityIndicatorProps",
|
|
253
|
-
"ButtonProps",
|
|
254
|
-
"CheckboxProps",
|
|
255
|
-
"DatePickerProps",
|
|
256
|
-
"ImageBackgroundProps",
|
|
257
|
-
"ImageProps",
|
|
258
|
-
"KeyboardAvoidingViewProps",
|
|
259
|
-
"ModalProps",
|
|
260
|
-
"PickerProps",
|
|
261
|
-
"PressableProps",
|
|
262
|
-
"ProgressBarProps",
|
|
263
|
-
"SafeAreaViewProps",
|
|
264
|
-
"ScrollViewProps",
|
|
265
|
-
"SegmentedControlProps",
|
|
266
|
-
"SliderProps",
|
|
267
|
-
"SpacerProps",
|
|
268
|
-
"StatusBarProps",
|
|
269
|
-
"SwitchProps",
|
|
270
|
-
"TextInputProps",
|
|
271
|
-
"TextProps",
|
|
272
|
-
"TouchableOpacityProps",
|
|
273
|
-
"ViewProps",
|
|
274
|
-
"WebViewProps",
|
|
275
242
|
# Core
|
|
276
243
|
"Element",
|
|
277
244
|
"create_screen",
|
|
@@ -283,13 +250,17 @@ __all__ = [
|
|
|
283
250
|
"MutationCall",
|
|
284
251
|
"MutationState",
|
|
285
252
|
"QueryResult",
|
|
253
|
+
"Ref",
|
|
286
254
|
"use_async_effect",
|
|
255
|
+
"use_back_handler",
|
|
287
256
|
"use_callback",
|
|
288
257
|
"use_color_scheme",
|
|
289
258
|
"use_context",
|
|
290
259
|
"use_effect",
|
|
291
260
|
"use_focus_effect",
|
|
261
|
+
"use_imperative_handle",
|
|
292
262
|
"use_keyboard_height",
|
|
263
|
+
"use_layout_effect",
|
|
293
264
|
"use_memo",
|
|
294
265
|
"use_mutation",
|
|
295
266
|
"use_navigation",
|
|
@@ -304,10 +275,13 @@ __all__ = [
|
|
|
304
275
|
"Provider",
|
|
305
276
|
# Navigation
|
|
306
277
|
"NavigationContainer",
|
|
278
|
+
"ScreenOptions",
|
|
307
279
|
"create_drawer_navigator",
|
|
308
280
|
"create_stack_navigator",
|
|
309
281
|
"create_tab_navigator",
|
|
310
282
|
# Styling - typed primitives
|
|
283
|
+
"AccessibilityState",
|
|
284
|
+
"AlignContent",
|
|
311
285
|
"AlignItems",
|
|
312
286
|
"AlignSelf",
|
|
313
287
|
"AutoCapitalize",
|
|
@@ -317,9 +291,11 @@ __all__ = [
|
|
|
317
291
|
"Dimension",
|
|
318
292
|
"EdgeInsets",
|
|
319
293
|
"FlexDirection",
|
|
294
|
+
"FlexWrap",
|
|
320
295
|
"FontWeight",
|
|
321
296
|
"JustifyContent",
|
|
322
297
|
"KeyboardType",
|
|
298
|
+
"LayoutDirection",
|
|
323
299
|
"Overflow",
|
|
324
300
|
"Position",
|
|
325
301
|
"ReturnKeyType",
|
|
@@ -374,6 +350,9 @@ __all__ = [
|
|
|
374
350
|
# Runtime
|
|
375
351
|
"run_async",
|
|
376
352
|
"runtime",
|
|
353
|
+
# Diagnostics
|
|
354
|
+
"HookOrderError",
|
|
355
|
+
"diagnostics",
|
|
377
356
|
# Platform
|
|
378
357
|
"Platform",
|
|
379
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.
|
|
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()]
|
|
@@ -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",
|
|
63
|
-
pn.Button("Open detail",
|
|
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",
|
|
75
|
+
pn.Button("Back", on_press=nav.go_back),
|
|
76
76
|
style={"spacing": 12, "padding": 16},
|
|
77
77
|
)
|
|
78
78
|
|