| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9daa7ff commit c588d11
377 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,6 +63,13 @@ Unsolicited pull requests for issues that are already assigned or already have a | |||
| 63 | 63 | ||
| 64 | 64 | - `src/pythonnative/`: installable library and CLI | |
| 65 | 65 | - Core Python modules, UI components, and utilities | |
| 66 | + - `components/`: element factories and the typed event records (`components/events.py`) | ||
| 67 | + - `handles.py`: typed imperative handles published on `ref.current` | ||
| 68 | + - `journal.py`: the undo journal a failed render pass rolls back through | ||
| 69 | + - `native_views/`: the thin backend accessor (`get_backend` / `set_backend`) and the bridge backend that serializes commits | ||
| 70 | + - `native_modules/`: device module facades and their Python fallbacks | ||
| 71 | + - `navigation/`: navigators, container, hooks, linking, theme, and the navigation ref | ||
| 72 | + - `testing/`: the headless testing library and the shipped pytest plugin (`testing/pytest_plugin.py`) | ||
| 66 | 73 | - `bridge/`: JSON codec and per-platform transports into the native rendering core | |
| 67 | 74 | - `cli/`: `pn` command | |
| 68 | 75 | - `project/`: config loading, template configuration, native plugin staging, and the builder behind `pn` | |
@@ -198,16 +205,18 @@ Recommended scopes (choose the smallest, most accurate unit; prefer module/direc | |||
| 198 | 205 | - `element`: Element descriptor class (`element.py`) | |
| 199 | 206 | - `events`: tag-based event routing between native views and Python callbacks (`events.py`) | |
| 200 | 207 | - `gestures`: gesture descriptors and the pure-Python recognition arbiter (`gestures.py`) | |
| 208 | + - `handles`: typed imperative handles published on refs (`handles.py`) | ||
| 201 | 209 | - `hooks`: hooks and contexts (`hooks.py`) | |
| 202 | 210 | - `hosts`: screen hosts, lifecycle forwarding, and render scheduling (`hosts/`) | |
| 203 | 211 | - `devserver`: dev server, file watcher, and WebSocket implementation (`devserver/`) | |
| 204 | 212 | - `devclient`: on-device dev client that syncs sources and Fast Refreshes (`devclient.py`) | |
| 205 | 213 | - `hot_reload`: module reloader and Fast Refresh (`hot_reload.py`) | |
| 214 | + - `journal`: render undo journal (`journal.py`) | ||
| 206 | 215 | - `layout`: Yoga layout integration and the host binding (`layout.py`, `native/yoga/`) | |
| 207 | 216 | - `mutations`: batched mutation ops between reconciler and native backends (`mutations.py`) | |
| 208 | 217 | - `native_modules`: native module registry, Python facades, and Python fallbacks (`native_modules/`) | |
| 209 | - - `native_views`: view registry protocol and bridge backend (`native_views/`) | ||
| 210 | - - `navigation`: navigation state, container, navigators, hooks, and linking (`navigation/`) | ||
| 218 | + - `native_views`: view backend accessor and bridge backend (`native_views/`) | ||
| 219 | + - `navigation`: navigation state, container, navigators, hooks, linking, theme, and ref (`navigation/`) | ||
| 211 | 220 | - `net`: awaitable HTTP client (`net.py`) | |
| 212 | 221 | - `package`: `src/pythonnative/__init__.py` exports and package boundary | |
| 213 | 222 | - `platform`: `Platform.OS`/`Platform.select` and version detection (`platform.py`) | |
@@ -220,7 +229,7 @@ Recommended scopes (choose the smallest, most accurate unit; prefer module/direc | |||
| 220 | 229 | - `storage`: AsyncStorage key/value persistence and `use_persisted_state` (`storage.py`) | |
| 221 | 230 | - `scheduler`: render batching and transition queues (`scheduler.py`) | |
| 222 | 231 | - `style`: StyleSheet and theming (`style.py`) | |
| 223 | - - `testing`: public test utilities (`testing/`) | ||
| 232 | + - `testing`: public test utilities and the pytest plugin (`testing/`) | ||
| 224 | 233 | - `utils`: shared utilities (`utils.py`) | |
| 225 | 234 | ||
| 226 | 235 | - Other scopes: | |
@@ -328,7 +337,7 @@ Co-authored-by: Name <email> | |||
| 328 | 337 | - PR title: Conventional Commits format (CI-enforced by `pr-lint.yml`). | |
| 329 | 338 | - Tests: added/updated; `uv run pytest` passes. | |
| 330 | 339 | - Lint/format: `uv run ruff check .` and `uv run black --check src examples tests` pass. | |
| 331 | - - Docs: update `README.md` if behavior changes. | ||
| 340 | + - Docs: update `README.md` and the affected pages under `docs/` if behavior changes; `uv run --group docs mkdocs build --strict` must pass. | ||
| 332 | 341 | - Templates: update `src/pythonnative/templates/` if generator output changes. | |
| 333 | 342 | - Generated contracts and example schemas are regenerated and reviewed when changed; vendored dependencies retain their licenses and provenance. | |
| 334 | 343 | - No local build outputs, caches, credentials, or machine-specific files are committed. | |
@@ -431,10 +440,14 @@ For tight iteration, run a single category instead of the full pass: | |||
| 431 | 440 | ||
| 432 | 441 | ```bash | |
| 433 | 442 | uv run ./scripts/run-e2e.sh android hooks | |
| 434 | - uv run ./scripts/run-e2e.sh ios components | ||
| 443 | + uv run ./scripts/run-e2e.sh ios navigation | ||
| 435 | 444 | ``` | |
| 436 | 445 | ||
| 437 | - Available categories: `components`, `hooks`, `navigation`, `layout`, `styling`, `animations`, `misc`. | ||
| 446 | + Each category is one file under `tests/e2e/suites/` (`hooks.yaml`, `navigation.yaml`, `gestures.yaml`, and so on; large areas are split into lettered parts such as `components-a.yaml`). List the directory for the current set: | ||
| 447 | + | ||
| 448 | + ```bash | ||
| 449 | + ls tests/e2e/suites | ||
| 450 | + ``` | ||
| 438 | 451 | ||
| 439 | 452 | A coverage checker, `scripts/check-e2e-coverage.py`, gates CI: every name in `pythonnative.__all__` must be covered by a demo + flow, or listed in `INTENTIONAL_EXEMPTIONS` with a justification. | |
| 440 | 453 | ||
@@ -443,7 +456,7 @@ When you add a new public symbol you must also: | |||
| 443 | 456 | 1. Add a demo screen under `examples/e2e-suite/app/screens/<category>/`. | |
| 444 | 457 | 2. Append a `DemoEntry` in `examples/e2e-suite/app/registry.py`. | |
| 445 | 458 | 3. Add a Maestro flow at `tests/e2e/flows/<category>/<name>.yaml`. | |
| 446 | - 4. Append the flow to the top-level `tests/e2e/android.yaml`, `tests/e2e/ios.yaml`, and the matching `tests/e2e/suites/<category>.yaml`. | ||
| 459 | + 4. Append the flow to the top-level `tests/e2e/android.yaml`, `tests/e2e/ios.yaml`, and the matching `tests/e2e/suites/<category>.yaml` (or the lettered part it belongs to). | ||
| 447 | 460 | 5. Confirm `uv run python scripts/check-e2e-coverage.py` exits 0. | |
| 448 | 461 | ||
| 449 | 462 | `tests/e2e/AGENTS.md` is the deeper reference (label conventions, failure triage, naming rules); AI agents should read it before touching the suite. The `e2e.yml` workflow runs the suite automatically on pushes to `main` and PRs. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,15 +30,17 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app | |||
| 30 | 30 | ||
| 31 | 31 | ## Features | |
| 32 | 32 | ||
| 33 | - - **Declarative components and hooks:** Describe native UI with Python functions, immutable elements, and typed styles. State, effects, context, and suspense boundaries follow one logical application tree across screens, overlays, and mounted list rows. | ||
| 33 | + - **Declarative components and hooks:** Describe native UI with Python functions, immutable elements, and typed styles. State, effects, context, and suspense boundaries follow one logical application tree across screens, overlays, and mounted list rows. State updates batch automatically, effect errors reach the nearest error boundary, and event callbacks receive typed records instead of dicts. | ||
| 34 | + - **React Native's core surface:** `Pressable`, `ScrollView`, `Text`, `TextInput`, `Image`, `Modal`, `FlatList`, and `SectionList` carry the props a React Native developer expects (disabled state and ripples, content insets and snapping, ellipsize modes and pressable spans, controlled selection and key events, sticky headers and inverted lists), plus typed imperative handles on `ref.current` and the full accessibility prop set. | ||
| 34 | 35 | - **Native widgets and layout:** Swift and Kotlin component managers own UIKit and Android widgets. The shared Yoga C++ engine computes layout beside the controls, using platform measurements for text and intrinsic sizes. | |
| 35 | 36 | - **Standard asyncio:** Components, effects, event handlers, and tasks run on a dedicated Python application thread. Native UI threads handle widgets, scrolling, and animation frames. Component-owned tasks are canceled on unmount. | |
| 36 | 37 | - **Incremental reconciliation:** State changes update affected component subtrees. Versioned bridge commits validate operations and acknowledge revisions; events and controlled text inputs carry identities that prevent stale updates. | |
| 37 | - - **Native lists and navigation:** UIKit collection views and Android recycler views recycle cells for fixed or variable row sizes, grids, sections, and horizontal lists. Native navigation containers present logical screen roots while providers and component state remain in the shared Python tree. | ||
| 38 | - - **Animation and gestures:** Serialized animation graphs support timing, springs, decay, arithmetic, interpolation, and native scroll and gesture bindings. Swift and Kotlin recognize mobile gestures and update supported animation bindings without Python work on every frame. | ||
| 38 | + - **Native lists and navigation:** UIKit collection views and Android recycler views recycle cells for fixed or variable row sizes, grids, sections, and horizontal lists. Native navigation containers present logical screen roots at every nesting level while providers and component state remain in the shared Python tree; navigators take screen options, groups, themes, tab-bar styles, and a navigation ref usable outside components. | ||
| 39 | + - **Animation and gestures:** Serialized animation graphs support timing with named or bezier easing, springs, React Native's decay model, arithmetic, interpolation, and native scroll and gesture bindings. Swift and Kotlin recognize mobile gestures with Gesture Handler-style activation offsets and update supported animation bindings without Python work on every frame. | ||
| 39 | 40 | - **Assets and graphics:** Drop images, fonts, and SVGs under `app/assets/` and reference them by path. Density variants, bundled fonts, a vector `Icon` set, `Svg` drawing, gradients, and blur render natively on both platforms and in the browser preview. | |
| 40 | - - **Device APIs:** Python facades expose camera, location, notifications, storage, permissions, and other native services. Test permissions and platform behavior on your deployment targets. | ||
| 41 | - - **Native extension SDK:** Python dataclasses and protocols define contracts; `pn codegen` generates props and module adapters for Swift and Kotlin. Plugins package native sources and resources, and builds verify matching contracts at startup. | ||
| 41 | + - **Device APIs:** Python facades expose camera, location, notifications, storage, permissions, keyboard, dimensions and pixel ratio, device info, localization, accessibility settings, and other native services, with a Python fallback for headless tests. Test permissions and platform behavior on your deployment targets. | ||
| 42 | + - **Native extension SDK:** Python dataclasses and protocols define contracts; `define_component` returns a typed element factory and `pn codegen` generates props and module adapters for Swift and Kotlin. Plugins package native sources and resources, and builds verify matching contracts at startup. | ||
| 43 | + - **Testing library:** `pythonnative.testing` renders components headlessly with Testing Library-style queries (`get_by_role`, `get_by_placeholder_text`, `within`, `find_by_*`), a virtual clock for timers, and a pytest plugin that resets the runtime between tests. | ||
| 42 | 44 | - **Development tools:** `pn start` serves the browser preview and connected mobile dev clients. Fast Refresh preserves compatible component state, while diagnostics report errors and invalid hook usage. Changes to native inputs trigger a rebuild. | |
| 43 | 45 | - **Browser preview:** `pn preview` runs your Python application against a browser renderer with DOM widgets, Yoga WebAssembly layout, and JavaScript animation graphs. It supports iteration on application logic and UI; fonts, platform controls, and device APIs require mobile testing. | |
| 44 | 46 | - **App packaging and dependency locks:** `pn run` and `pn build` stage bundled app templates, native libraries, and Python sources. Target-specific wheel locks record dependency versions and hashes for mobile builds. Binary dependencies need compatible mobile wheels; `pn deps` reports target resolution. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,24 @@ Python reconciliation on each frame. Unattached values, Python listeners, | |||
| 10 | 10 | callable easing functions, and backends that decline native animation use | |
| 11 | 11 | the Python ticker. | |
| 12 | 12 | ||
| 13 | + A few types frame the surface: | ||
| 14 | + | ||
| 15 | + - [`Easing`][pythonnative.animated.Easing] is a namespace of | ||
| 16 | + serializable [`EasingSpec`][pythonnative.animated.EasingSpec] curves | ||
| 17 | + (`Easing.ease_out`, `Easing.bezier(...)`) accepted by | ||
| 18 | + `Animated.timing(easing=...)`; a misspelled easing name raises | ||
| 19 | + `ValueError` instead of falling back. | ||
| 20 | + - `await handle` and `handle.start(callback)` deliver an | ||
| 21 | + [`AnimationResult`][pythonnative.animated.AnimationResult] whose | ||
| 22 | + `finished` flag tells a stopped or superseded animation from one that | ||
| 23 | + ran to completion. | ||
| 24 | + - [`ANIMATABLE_PROPS`][pythonnative.animated.ANIMATABLE_PROPS] lists | ||
| 25 | + the style keys an animated node may drive; binding a layout key such | ||
| 26 | + as `width` raises `ValueError` at element construction. | ||
| 27 | + - `Animated.decay` uses React Native's model on every platform: | ||
| 28 | + velocity in points per millisecond decays as | ||
| 29 | + `v0 * deceleration ** t`, with `deceleration` defaulting to `0.998`. | ||
| 30 | + | ||
| 13 | 31 | ::: pythonnative.animated | |
| 14 | 32 | options: | |
| 15 | 33 | show_root_heading: false | |
@@ -21,6 +39,7 @@ the Python ticker. | |||
| 21 | 39 | ## See also | |
| 22 | 40 | ||
| 23 | 41 | - The [Animations guide](../guides/animations.md) walks through | |
| 24 | - fade-ins, springs, sequences, and gesture-driven animations. | ||
| 42 | + fade-ins, springs, sequences, easing, decay, and gesture-driven | ||
| 43 | + animations. | ||
| 25 | 44 | - [`use_ref`][pythonnative.use_ref] explains the `ref` semantics that | |
| 26 | 45 | back `Animated.View`. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments