https://github.com/pythonnative/pythonnative
Build real native Android and iOS apps in Python with a lightweight UI toolkit, CLI, and project templates.
https://github.com/pythonnative/pythonnative
android beeware cli cross-platform django gradle ios kotlin mobile-development native-ui python python-mobile-apps rubicon swift ui-components xcode
Last synced: 1 day ago
JSON representation
Build real native Android and iOS apps in Python with a lightweight UI toolkit, CLI, and project templates.
- Host: GitHub
- URL: https://github.com/pythonnative/pythonnative
- Owner: pythonnative
- License: mit
- Created: 2025-09-05T01:41:48.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-03-31T06:35:05.000Z (about 1 month ago)
- Last Synced: 2026-03-31T07:50:49.733Z (about 1 month ago)
- Topics: android, beeware, cli, cross-platform, django, gradle, ios, kotlin, mobile-development, native-ui, python, python-mobile-apps, rubicon, swift, ui-components, xcode
- Language: Python
- Homepage: https://docs.pythonnative.com
- Size: 1.68 MB
- Stars: 7
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Build native Android and iOS apps in Python.
Documentation ·
Getting Started ·
Examples ·
Contributing
---
## Overview
PythonNative is a cross-platform toolkit for building native Android and iOS apps in Python. It provides a **declarative, React-like component model** with hooks and automatic reconciliation, powered by Chaquopy on Android and rubicon-objc on iOS. Write function components with `use_state`, `use_effect`, and friends, just like React, and let PythonNative handle creating and updating native views.
## Features
- **Declarative UI:** Describe *what* your UI should look like with element functions (`Text`, `Button`, `Column`, `Row`, etc.). PythonNative creates and updates native views automatically.
- **Hooks and function components:** Manage state with `use_state`, side effects with `use_effect`, and navigation with `use_navigation`, all through one consistent pattern.
- **`style` prop:** Pass all visual and layout properties through a single `style` dict, composable via `StyleSheet`.
- **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.
- **Virtual view tree + reconciler:** Element trees are diffed and patched with minimal native mutations, similar to React's reconciliation.
- **Direct native bindings:** Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge.
- **CLI scaffolding:** `pn init` creates a ready-to-run project; `pn run android` and `pn run ios` build and launch your app.
- **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.
- **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.
- **Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
## Quick Start
### Installation
```bash
pip install pythonnative
```
### Usage
```python
import pythonnative as pn
@pn.component
def App():
count, set_count = pn.use_state(0)
return pn.Column(
pn.Text(f"Count: {count}", style={"font_size": 24}),
pn.Button(
"Tap me",
on_click=lambda: set_count(count + 1),
),
style={"spacing": 12, "padding": 16},
)
```
## Documentation
Visit [docs.pythonnative.com](https://docs.pythonnative.com/) for the full documentation, including getting started guides, platform-specific instructions for Android and iOS, API reference, and working examples.
## Contributing
Contributions are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, coding standards, and guidelines for submitting pull requests.
## License
[MIT](LICENSE)