|
1 | | -## PythonNative |
2 | | - |
3 | | -[](https://github.com/pythonnative/pythonnative/actions/workflows/ci.yml) |
4 | | -[](https://github.com/pythonnative/pythonnative/actions/workflows/docs.yml) |
5 | | -[](https://github.com/pythonnative/pythonnative/actions/workflows/release.yml) |
6 | | -[](https://pypi.org/project/pythonnative/) |
7 | | -[](https://pypi.org/project/pythonnative/) |
8 | | -[](LICENSE) |
9 | | -[](https://docs.pythonnative.com/) |
10 | | - |
11 | | -PythonNative is a cross‑platform toolkit for building native Android and iOS |
12 | | -apps in Python. It provides a Pythonic API for native UI components, |
13 | | -lifecycle events, and device capabilities, powered by Rubicon (iOS) and |
14 | | -Chaquopy (Android). For guides, API reference, and examples, see the |
15 | | -[docs](https://docs.pythonnative.com/). |
| 1 | +<p align="center"> |
| 2 | + <img src="docs/assets/banner.jpg" alt="PythonNative" width="800" /> |
| 3 | +</p> |
| 4 | + |
| 5 | +<p align="center"> |
| 6 | + <em>Build native Android and iOS apps in Python.</em> |
| 7 | +</p> |
| 8 | + |
| 9 | +<p align="center"> |
| 10 | + <a href="https://github.com/pythonnative/pythonnative/actions/workflows/ci.yml"><img src="https://github.com/pythonnative/pythonnative/actions/workflows/ci.yml/badge.svg" alt="CI" /></a> |
| 11 | + <a href="https://github.com/pythonnative/pythonnative/actions/workflows/release.yml"><img src="https://github.com/pythonnative/pythonnative/actions/workflows/release.yml/badge.svg" alt="Release" /></a> |
| 12 | + <a href="https://pypi.org/project/pythonnative/"><img src="https://img.shields.io/pypi/v/pythonnative" alt="PyPI Version" /></a> |
| 13 | + <a href="https://pypi.org/project/pythonnative/"><img src="https://img.shields.io/pypi/pyversions/pythonnative" alt="Python Versions" /></a> |
| 14 | + <a href="LICENSE"><img src="https://img.shields.io/pypi/l/pythonnative" alt="License: MIT" /></a> |
| 15 | + <a href="https://docs.pythonnative.com/"><img src="https://img.shields.io/website?url=https%3A%2F%2Fdocs.pythonnative.com&label=docs" alt="Docs" /></a> |
| 16 | +</p> |
| 17 | + |
| 18 | +<p align="center"> |
| 19 | + <a href="https://docs.pythonnative.com/">Documentation</a> · |
| 20 | + <a href="https://docs.pythonnative.com/getting-started/">Getting Started</a> · |
| 21 | + <a href="https://docs.pythonnative.com/examples/">Examples</a> · |
| 22 | + <a href="CONTRIBUTING.md">Contributing</a> |
| 23 | +</p> |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Overview |
| 28 | + |
| 29 | +PythonNative is a cross-platform toolkit for building native Android and iOS apps in Python. It provides a Pythonic API for native UI components, lifecycle events, and device capabilities, powered by Chaquopy on Android and rubicon-objc on iOS. Write your app once in Python and run it on both platforms with genuinely native interfaces. |
| 30 | + |
| 31 | +## Features |
| 32 | + |
| 33 | +- **Cross-platform native UI:** Build Android and iOS apps from a single Python codebase with truly native rendering. |
| 34 | +- **Direct native bindings:** Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge. |
| 35 | +- **Unified component API:** Components like `Page`, `StackView`, `Label`, `Button`, and `WebView` share a consistent interface across platforms. |
| 36 | +- **CLI scaffolding:** `pn init` creates a ready-to-run project structure; `pn run android` and `pn run ios` build and launch your app. |
| 37 | +- **Page lifecycle:** Hooks for `on_create`, `on_start`, `on_resume`, `on_pause`, `on_stop`, and `on_destroy`, with state save and restore. |
| 38 | +- **Navigation:** Push and pop screens with argument passing for multi-page apps. |
| 39 | +- **Rich component set:** Core views (Label, Button, TextField, ImageView, WebView, Switch, DatePicker, and more) plus Material Design variants. |
| 40 | +- **Bundled templates:** Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access. |
| 41 | + |
| 42 | +## Quick Start |
| 43 | + |
| 44 | +### Installation |
| 45 | + |
| 46 | +```bash |
| 47 | +pip install pythonnative |
| 48 | +``` |
| 49 | + |
| 50 | +### Usage |
| 51 | + |
| 52 | +```python |
| 53 | +import pythonnative as pn |
| 54 | + |
| 55 | + |
| 56 | +class MainPage(pn.Page): |
| 57 | + def __init__(self, native_instance): |
| 58 | + super().__init__(native_instance) |
| 59 | + |
| 60 | + def on_create(self): |
| 61 | + super().on_create() |
| 62 | + stack = pn.StackView() |
| 63 | + stack.add_view(pn.Label("Hello from PythonNative!")) |
| 64 | + button = pn.Button("Tap me") |
| 65 | + button.set_on_click(lambda: print("Button tapped")) |
| 66 | + stack.add_view(button) |
| 67 | + self.set_root_view(stack) |
| 68 | +``` |
| 69 | + |
| 70 | +## Documentation |
| 71 | + |
| 72 | +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. |
| 73 | + |
| 74 | +## Contributing |
| 75 | + |
| 76 | +Contributions are welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, coding standards, and guidelines for submitting pull requests. |
| 77 | + |
| 78 | +## License |
| 79 | + |
| 80 | +[MIT](LICENSE) |
0 commit comments