Build native Android and iOS apps in Python.
Documentation · Getting Started · Examples · Contributing
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.
- Cross-platform native UI: Build Android and iOS apps from a single Python codebase with truly native rendering.
- Direct native bindings: Python calls platform APIs directly through Chaquopy and rubicon-objc, with no JavaScript bridge.
- Unified component API: Components like
Page,StackView,Label,Button, andWebViewshare a consistent interface across platforms. - CLI scaffolding:
pn initcreates a ready-to-run project structure;pn run androidandpn run iosbuild and launch your app. - Page lifecycle: Hooks for
on_create,on_start,on_resume,on_pause,on_stop, andon_destroy, with state save and restore. - Navigation: Push and pop screens with argument passing for multi-page apps.
- Rich component set: Core views (Label, Button, TextField, ImageView, WebView, Switch, DatePicker, and more) plus Material Design variants.
- Bundled templates: Android Gradle and iOS Xcode templates are included, so scaffolding requires no network access.
pip install pythonnativeimport pythonnative as pn
class MainPage(pn.Page):
def __init__(self, native_instance):
super().__init__(native_instance)
def on_create(self):
super().on_create()
stack = pn.StackView()
stack.add_view(pn.Label("Hello from PythonNative!"))
button = pn.Button("Tap me")
button.set_on_click(lambda: print("Button tapped"))
stack.add_view(button)
self.set_root_view(stack)Visit docs.pythonnative.com for the full documentation, including getting started guides, platform-specific instructions for Android and iOS, API reference, and working examples.
Contributions are welcome. Please see CONTRIBUTING.md for setup instructions, coding standards, and guidelines for submitting pull requests.
