Introduction
Build cross-platform desktop apps with React and Python
Positron
Build cross-platform desktop apps with React and Python
Positron is an Electron-like framework that lets you create desktop applications using React for the UI and Python for the backend. It uses real browser engines (WebView2/WebKit) to render your React apps natively.
from positron import App, BrowserWindow
app = App()
def create_window():
win = BrowserWindow({'width': 800, 'height': 600})
win.load_url('http://localhost:5173')
app.when_ready(create_window)
app.run()Features
- Familiar API: If you know Electron, you know Positron
- React Support: Full support for modern React with Vite
- Python Backend: Access to the entire Python ecosystem
- IPC Communication: Bidirectional messaging between React and Python
- Native Windows: Real native window management with Tkinter
- Cross-Platform: Works on Windows, macOS, and Linux
Why Positron?
Use Python Instead of Node.js
- Leverage Python's rich ecosystem (AI/ML, data science, automation)
- Write backend logic in Python instead of JavaScript
- Access native system APIs through Python
Electron-like Developer Experience
- Same API structure as Electron
- Hot reload during development
- Familiar project structure
Lightweight Alternative
- Uses system webview instead of bundled Chromium
- Smaller bundle sizes
- Lower memory footprint
Comparison with Electron
| Feature | Electron | Positron |
|---|---|---|
| Backend Language | Node.js | Python |
| Renderer | Chromium (bundled) | System WebView |
| HTML/CSS Support | HTML5, CSS3 | HTML5, CSS3 ✅ |
| JavaScript | Full V8 | Full (WebView2/WebKit) ✅ |
| React Support | ✅ Full | ✅ Full |
| IPC API | ✅ | ✅ Same API |
| Window API | ✅ | ✅ Same API |
| App Lifecycle | ✅ | ✅ Same API |
| Bundle Size | Large (~150MB) | Small (~5-10MB) |
| Memory Usage | High | Lower |
Supported Technologies
Frontend (via pywebview)
- ✅ Full React support - Modern React with hooks, ES modules, everything!
- ✅ HTML5 / CSS3
- ✅ Modern JavaScript (ES6+)
- ✅ Any modern web framework (Vue, Angular, Svelte)
- ✅ WebView2 (Windows), WebKit (macOS), GTK WebKit (Linux)
Backend (Python)
- ✅ Any Python library
- ✅ Machine Learning (TensorFlow, PyTorch)
- ✅ Data Science (NumPy, Pandas)
- ✅ Web Scraping (Requests, BeautifulSoup)
- ✅ Automation (Selenium, PyAutoGUI)
- ✅ Database (SQLite, PostgreSQL, MongoDB)
Roadmap
- Core architecture (Main + Renderer processes)
- BrowserWindow API
- App lifecycle management
- IPC communication
- React/Vite integration
- Menu API
- Dialog API
- Tray API
- Notifications
- Auto-updater
- Application packaging
- More examples
License
MIT License - see LICENSE file for details
Credits
Built on top of: