FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: remove overhaul report and refresh runtime guides (#84) · pythonnative/pythonnative@607e0c7 · GitHub

Commit 607e0c7

Browse files
authored
docs: remove overhaul report and refresh runtime guides (#84)
1 parent b52499e commit 607e0c7

47 files changed

Lines changed: 399 additions & 375 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CONTRIBUTING.md‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Co-authored-by: Name <email>
342342
4. Each wheel is repaired where needed, installed in an isolated environment, and tested with the Yoga layout suite and CLI. The complete artifact set must also pass platform, version, resource, and metadata checks.
343343
5. Validated distributions are attached to the GitHub release before PyPI uploads begin. PyPI uses Trusted Publishing; no API token is needed.
344344
- The same distribution builds and checks run on PRs. The wheel matrix covers CPython 3.13 and 3.14 on Linux x86-64 and ARM64 (glibc 2.28 or newer), macOS Intel and Apple Silicon (macOS 11 or newer), and Windows x64. These are development-host wheels; mobile apps compile the bundled Yoga source in their native builds.
345-
- Build policy lives in `scripts/cibuildwheel.toml`, separately from the tagged package source, so fixed tooling can rebuild an older release without changing its code or version. Windows compiler/linker flags also support the original `v0.40.0` source; newer source distributions include the export settings in `setup.py`.
345+
- Build policy lives in `scripts/cibuildwheel.toml`, separately from the tagged package source, so fixed tooling can rebuild an existing release without changing its code or version.
346346
- Commit types that trigger a release: `feat` (minor), `fix` and `perf` (patch), and `BREAKING CHANGE` (major, or minor before 1.0). Other types, including `build` and `ci`, don't trigger a release on their own. Use a `build` or `ci` title for a publishing-only repair that should recover the existing version.
347347
- Tag format: `v`-prefixed (for example, `v0.40.0`). Manual version bumps aren't needed.
348348

@@ -352,9 +352,10 @@ Version creation and package publication are separate jobs. A GitHub release can
352352
exist even when its PyPI upload failed. Rerunning version creation won't create
353353
another release for the same commits.
354354

355-
Once the workflow repair is merged, select **Actions → Release → Run workflow**,
356-
choose `main`, and enter the existing tag in the recovery field. With the GitHub
357-
CLI, the equivalent is:
355+
To resume publication, select **Actions → Release → Run workflow**, choose
356+
`main`, and enter the existing tag in the recovery field. If the failure
357+
requires a workflow repair, merge that repair first. For example, with the
358+
GitHub CLI:
358359

359360
```bash
360361
gh workflow run release.yml --ref main -f tag=v0.40.0
@@ -374,10 +375,6 @@ or commit to check. This runs the full matrix without publishing anything:
374375
gh workflow run wheels.yml --ref main -f source-ref=v0.40.0
375376
```
376377

377-
A source-only install of `v0.40.0` on Windows still needs the export flags from
378-
`scripts/cibuildwheel.toml`; its tagged `setup.py` predates that fix. The recovered
379-
Windows wheels include those exports and install without a compiler.
380-
381378
### Branch naming (suggested)
382379

383380
- Use lowercase kebab‑case; concise (≤ 40 chars).

‎README.md‎

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,17 @@ PythonNative is a cross-platform toolkit for building native Android and iOS app
3030

3131
## Features
3232

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-
- **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-
- **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` / `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-
- **Async-first rendering:** One `asyncio` event loop runs the whole framework on the platform's main thread. Components can be `async def` and `await` data directly in the body; `Suspense` boundaries show declarative loading states while they wait. `use_resource` fetches during render, `use_effect` accepts coroutine callbacks (cancelled automatically on unmount), `lazy` code-splits components, and `use_transition` / `use_deferred_value` keep the UI responsive during expensive updates.
38-
- **Developer feedback that finds your bugs:** In dev mode (`pn start`, `pn preview`, debug builds from `pn run`, 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.
39-
- **Typed `style` prop and theme:** 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`, and read design tokens from a typed, immutable `pn.Theme` via `use_theme()` that follows light and dark mode by default.
40-
- **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.
41-
- **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.
42-
- **Native-driven animations:** The `Animated` API (timing / spring / decay / loop / stagger, awaitable or fire-and-forget) hands animations to Core Animation and `ViewPropertyAnimator` whenever possible, so no Python code runs per frame; a pure-Python ticker covers the rest. `interpolate`, arithmetic operators on animated nodes, `Animated.event` scroll binding, and `diff_clamp` cover the scroll-driven patterns (collapsing headers, parallax) that define native feel.
43-
- **Native gesture system:** Attach `Tap`, `LongPress`, `Pan`, `Swipe`, `Fling`, `Pinch`, and `Rotation` recognizers to any view via the `gestures=` prop, backed by `UIGestureRecognizer` on iOS and a unit-testable pure-Python arbiter on Android and in the browser preview. Compose them with `Race`, `Exclusive`, and `Simultaneous` for cross-gesture arbitration (single vs. double tap, drag vs. long press).
44-
- **Virtualized lists:** `FlatList` / `SectionList` window their rows in Python over the platform scroll view: uniform, exact, or measured variable heights, grids, headers/footers, infinite scroll, and an imperative scroll controller, identical on every platform.
45-
- **Native rendering core:** each commit is one serialized transaction applied by Swift and Kotlin component managers, the same shape as React Native's Fabric. Device APIs are native modules registered by name (TurboModules-style), callable from thin Python facades.
46-
- **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.
47-
- **Metro-style dev loop:** `pn start` runs one dev server that serves the browser preview and every connected debug build. Save a file and each client Fast Refreshes in place, keeping component state; their `print` output and tracebacks stream back into the same terminal. `pn run android` / `pn run ios` bakes the server URL into a debug build and rebuilds the native project only when a native input actually changed, so relaunching after a Python edit takes seconds, not minutes.
48-
- **PyPI packages, binary wheels included:** List requirements in `pythonnative.toml` and the CLI resolves them for the *device* (iOS wheels via PEP 730 and BeeWare's index, Android wheels via PEP 738 and Chaquopy), bundling numpy, Pillow, cryptography, and friends alongside pure-Python packages. `pn deps` reports what each target resolves to before you build, and a weekly-checked compatibility matrix keeps the docs honest.
49-
- **Browser preview:** `pn preview` renders your app in a browser tab inside a phone frame (pick a device, rotate, toggle dark mode) with Fast Refresh on every save. The page is a bridge peer exactly like the Swift and Kotlin runtimes, so the reconciler, hooks, layout engine, navigation, and screen host are the same code that ships to the phone; only the leaf widgets are DOM elements.
50-
- **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.
51-
- **Dev client:** Build a shell app once with `pn run ios --dev-client` and point it at any project's dev server from a connect screen, the way Expo Go does; physical phones on the same Wi-Fi get the same Fast Refresh as simulators.
52-
- **Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
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.
34+
- **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+
- **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+
- **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.
39+
- **Device APIs:** Python facades expose camera, location, notifications, storage, permissions, and other native services. Test permissions and platform behavior on your deployment targets.
40+
- **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+
- **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.
42+
- **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.
43+
- **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.
5344

5445
## Quick Start
5546

‎docs/api/animated.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ PythonNative's `Animated` API mirrors React Native's. Build performant
44
animations declaratively by binding [`AnimatedValue`][pythonnative.AnimatedValue]
55
instances to the `style` of an `Animated.View`, `Animated.Text`, or
66
`Animated.Image`. The reconciler holds a `ref` to the underlying
7-
native view; the animation driver pushes value changes directly to
8-
the native handler's `set_animated_property` hook so per-frame updates
9-
bypass full reconciliation.
7+
native view. Connected values, derived expressions, and style bindings
8+
form a graph evaluated by the renderer, so supported animations bypass
9+
Python reconciliation on each frame. Unattached values, Python listeners,
10+
callable easing functions, and backends that decline native animation use
11+
the Python ticker.
1012

1113
::: pythonnative.animated
1214
options:

‎docs/api/component-properties.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Component Property Reference
1+
# Component property reference
22

33
All visual and layout properties are passed via the `style` dict (or list of dicts) to element functions. Behavioural properties (callbacks, data, content) remain as keyword arguments.
44

5-
> Layout is computed by PythonNative's pure-Python flexbox engine (see
6-
> [Layout engine](../concepts/layout.md)). The same `style` keys produce the
7-
> same frames on Android and iOS; every property listed below is honoured by
8-
> the engine and applied via `set_frame` on the underlying native view.
5+
Layout properties are interpreted by Yoga beside the native widgets, with
6+
platform measurements for text and controls. Visual properties are applied by
7+
component managers. The browser preview uses Yoga WebAssembly and DOM widgets.
8+
See [Layout engine](../concepts/layout.md) for the shared rules and platform
9+
differences.
910

1011
## Common layout properties (inside `style`)
1112

@@ -476,12 +477,12 @@ pn.FlatList(data=items, render_item=render_fn, key_extractor=key_fn,
476477
- `data`: list of items
477478
- `render_item`: `(item, index) -> Element` function
478479
- `key_extractor`: `(item, index) -> str` for stable keys
479-
- `item_height`: fixed row height; qualifies the list for the native
480-
RecyclerView / UICollectionView virtualization path (see the
480+
- `item_height`: fixed row extent; reduces measurement work in the native
481+
RecyclerView / UICollectionView containers (see the
481482
[Lists guide](../guides/lists.md))
482483
- `separator_height`: spacing between items
483-
- `horizontal`: lay rows out left-to-right (Python-windowed engine)
484-
- `num_columns`: render as a grid of N columns (Python-windowed engine)
484+
- `horizontal`: scroll horizontally; row extents become widths
485+
- `num_columns`: render as a grid of N columns
485486
- `list_header` / `list_footer`: elements rendered once above / below rows
486487
- `list_empty`: element rendered when `data` is empty
487488
- `on_end_reached`: callback `() -> None` near the end (virtualized)

‎docs/api/hosts.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Hosts
22

3-
A screen host owns a [`Reconciler`][pythonnative.reconciler.Reconciler],
4-
schedules re-renders, and forwards platform lifecycle events (resume,
5-
pause, back press, destroy) to navigators and effects. It's also the
6-
[`HostNavigator`][pythonnative.navigation.HostNavigator] a root
7-
[`Stack.Navigator`][pythonnative.create_stack_navigator] talks to when
8-
it pushes real native screens.
3+
An application surface host owns a
4+
[`Reconciler`][pythonnative.reconciler.Reconciler], schedules Python work,
5+
and forwards lifecycle, viewport, and back events. Its logical tree includes
6+
screens, overlays, and mounted list rows. Native containers present those
7+
children without creating a separate Python host for every screen or row.
8+
9+
The host also publishes cached navigation restoration state through the
10+
`Host` module. It implements the
11+
[`HostNavigator`][pythonnative.navigation.HostNavigator] interface used by
12+
navigation and headless tests.
913

1014
The bundled Android (`PNScreenFragment`) and iOS (`PNViewController`)
1115
templates create a host through the `Host` native module's `create`

‎docs/api/layout.md‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Layout
22

3-
The pure-Python flexbox engine that computes a frame
4-
`(x, y, width, height)` for every node in the rendered tree. The
5-
[`Reconciler`][pythonnative.reconciler.Reconciler] runs
6-
[`calculate_layout`][pythonnative.layout.calculate_layout] after every
7-
commit and forwards the resulting frames to the platform handlers via
8-
`set_frame`.
3+
The Python binding to Yoga's C++ flexbox engine. Headless tests use
4+
[`LayoutNode`][pythonnative.layout.LayoutNode] and
5+
[`calculate_layout`][pythonnative.layout.calculate_layout] to compute
6+
frames `(x, y, width, height)` with stub intrinsic measurements.
7+
8+
Mobile renderers compile the same Yoga core into their native libraries and
9+
measure content beside their widgets. The browser preview runs Yoga
10+
WebAssembly. Those renderers return changed frames to the Python reconciler
11+
through the bridge.
912

1013
For a conceptual overview, see [Layout engine](../concepts/layout.md).
1114

‎docs/api/runtime.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ that thread. UIKit and Android retain their own UI threads; native bridge calls
66
marshal view operations there and queue events back to Python.
77

88
Ordinary asyncio networking, `TaskGroup`, timeouts, synchronization primitives,
9-
and third-party async libraries work without a guest-loop adapter. A synchronous
9+
and third-party async libraries run on this loop. A synchronous
1010
Python callback can still delay other Python work, so use `asyncio.to_thread`
1111
for blocking I/O and cooperative async work for long operations.
1212

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL