PyTauri¶
Tauri bindings for Python through Pyo3
Documentation: https://wsh032.github.io/pytauri/
Source Code: https://github.com/WSH032/pytauri/
Features¶
TL;DR
You are hurry and just wanna see/run the demo? See examples/tauri-app.
- Need Rust compiler, but almost don't need to write Rust code!
- Can be integrated with
tauri-cli
to build and package standalone executables! - No IPC (inter-process communication) overhead, secure and fast, thanks to Pyo3!
-
Support Tauri official plugins(e.g., notification), and you can write your own plugins!
-
Natively support async python (
asyncio
,trio
oranyio
) - 100% Type Completeness
-
Ergonomic API (and as close as possible to the Tauri Rust API)
-
Python
import sys from pydantic import BaseModel from pytauri import ( AppHandle, Commands, ) from pytauri_plugin_notification import NotificationBuilderArgs, NotificationExt commands: Commands = Commands() class Person(BaseModel): name: str class Greeting(BaseModel): message: str @commands.command() async def greet(body: Person, app_handle: AppHandle) -> Greeting: notification_builder = NotificationExt.builder(app_handle) notification_builder.show( NotificationBuilderArgs(title="Greeting", body=f"Hello, {body.name}!") ) return Greeting( message=f"Hello, {body.name}! You've been greeted from Python {sys.version}!" )
-
Frontend
import { pyInvoke } from "tauri-plugin-pytauri-api"; // or: `const { pyInvoke } = window.__TAURI__.pytauri;` export interface Person { name: string; } export interface Greeting { message: string; } export async function greet(body: Person): Promise<Greeting> { return await pyInvoke("greet", body); }
-
Release¶
name | pypi | crates.io | npmjs |
---|---|---|---|
👉 core | - | - | - |
pytauri | |||
pytauri-core | |||
tauri-plugin-pytauri | |||
👉 plugins | - | - | - |
pytauri-plugin-notification | |||
👉 utils | - | - | - |
pyo3-utils | |||
codelldb |
Philosophy¶
For Pythoneer¶
I hope PyTauri
can become an alternative to pywebview and Pystray, leveraging Tauri's comprehensive features to offer Python developers a GUI framework and a batteries-included development experience similar to electron and PySide.
PyTauri is inspired by FastAPI and Pydantic, aiming to offer a similar development experience.
For Rustacean¶
Through Pyo3, I hope Rust developers can better utilize the Python ecosystem (e.g., building AI GUI applications with PyTorch).
Although Rust's lifetime and ownership system makes Rust code safer, Python's garbage collection (GC) will make life easier. 😆
The Future¶
In the future, I hope PyTauri can integrate with nicegui and gradio, bringing you a Python full-stack (i.g., without Node.js
) development experience.
Credits¶
PyTauri is a project that aims to provide Python bindings for Tauri, a cross-platform webview GUI library. Tauri
is a trademark of the Tauri Program within the Commons Conservancy and PyTauri is not officially endorsed or supported by them. PyTauri is an independent and community-driven effort that respects the original goals and values of Tauri. PyTauri does not claim any ownership or affiliation with the Tauri Program.
License¶
This project is licensed under the terms of the Apache License 2.0.