Getting Started¶
Before starting the tutorial, we recommend installing the following tools, which are considered best practices for initializing a pytauri project. We will use these tools throughout the tutorial.
- create-tauri-app:
v4.5.9
- uv:
v0.5.11
- tauri-cli:
v2.1.0
Note
The specified versions above are the ones used when writing this tutorial. You can use other versions, but the usage might differ from the examples in this tutorial.
Full Example¶
https://github.com/WSH032/pytauri/tree/main/examples/tauri-app
Create a new tauri project¶
ref: https://tauri.app/start/create-project/#using-create-tauri-app
Note
In this tutorial, we will use pnpm to manage the frontend.
However, pytauri does not have any opinion on which frontend framework you use. You can even serve the frontend resources via a server using a URL.
pnpm create tauri-app
? Project name (tauri-app) ›
? Identifier (com.tauri-app.app) ›
? Choose which language to use for your frontend ›
❯ TypeScript / JavaScript (pnpm, yarn, npm, deno, bun)
? Choose your package manager ›
❯ pnpm
? Choose your UI template ›
❯ Vanilla
? Choose your UI flavor ›
❯ TypeScript
You will get the following directory structure:
└── tauri-app
├── README.md
├── index.html
├── package.json
├── src
│ ├── assets
│ ├── main.ts
│ └── styles.css
├── src-tauri
│ ├── Cargo.toml
│ ├── build.rs
│ ├── capabilities
│ ├── icons
│ ├── src
│ └── tauri.conf.json
├── tsconfig.json
└── vite.config.ts
/tauri-app
: for the frontend/tauri-app/src-tauri
: for rust and python backend
Launch the tauri app¶
- This command will install
tuari-cli
- use
tauri-cli
to start the app
Info
The first run will take some time to compile the dependencies, subsequent launches will be much faster.
Congratulations! When you finally see a window with web content appear, you have successfully created a Tauri application.
Next Steps¶
Next, we will demonstrate how to integrate Python into the Tauri application using pytauri.