Skip to content

Commit 74dbb61

Browse files
committed
update docs
1 parent 9974c8e commit 74dbb61

File tree

3 files changed

+447
-138
lines changed

3 files changed

+447
-138
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ A native app built with Tauri version 2 that spawns a Python sub-process (sideca
55
[Download the example app and try out](https://github.com/dieharders/example-tauri-v2-python-server-sidecar/releases)
66

77
![Python](https://img.shields.io/badge/-Python-000?&logo=Python)
8-
![JavaScript](https://img.shields.io/badge/-JavaScript-000?&logo=JavaScript)
98
![TypeScript](https://img.shields.io/badge/-TypeScript-000?&logo=TypeScript)
109
![Rust](https://img.shields.io/badge/-Rust-000?&logo=Rust)
1110
<br/>
@@ -15,8 +14,8 @@ A native app built with Tauri version 2 that spawns a Python sub-process (sideca
1514

1615
> [!NOTE]
1716
>
18-
> <h3>Tauri v1 example is also available:
19-
> <a href="https://github.com/dieharders/example-tauri-python-server-sidecar" style="color: #228be6">example-tauri-python-server-sidecar</a></h3>
17+
> <strong>Tauri v1 example also available:
18+
> <a href="https://github.com/dieharders/example-tauri-python-server-sidecar" style="color: #228be6">example-tauri-python-server-sidecar</a></strong>
2019
2120
![logo](extras/sidecar-logo.png "python sidecar logo")
2221

@@ -28,17 +27,17 @@ This template project is intended to demonstrate the use of single file Python e
2827

2928
![app screenshot](extras/screenshot.png "app screenshot")
3029

31-
The use of "sidecars" is to allow developers to package dependencies to make installation easier on the user. Tauri allows the frontend to communicate with any runtime and gives access to the OS's disk, camera, and other native hardware features. This is defined in the `tauri.conf.json` file. See [here](https://v2.tauri.app/develop/sidecar/) for more info.
30+
Tauri "sidecars" allow developers to package dependencies to make installation easier on the user. Tauri's API allows the frontend to communicate with any runtime and give it access to the OS disk, camera, and other native hardware features. This is defined in the `tauri.conf.json` file. See [here](https://v2.tauri.app/develop/sidecar/) for more info.
3231

3332
## How It Works
3433

3534
![python sidecar architecture](extras/diagram.png "python sidecar architecture")
3635

37-
- Tauri takes your frontend UI written in html/javascript and displays it in a native webview. This makes the resulting file size smaller since it does not need to include a web browser.
36+
- Tauri takes your frontend UI written in html/javascript and displays it in a native webview. This makes the resulting file size smaller since it does not need to include a web browser (as Electron.js requires).
3837

3938
- [PyInstaller](https://pyinstaller.org/en/stable/) is used to compile a binary of the Python code so users don't have to worry about installing dependencies.
4039

41-
- In `main.rs` we spawn a python binary ("sidecar") called `main.exe` which starts an api server on `localhost:8008`. The frontend tells Tauri to startup and shutdown the sidecar via stdin/stdout commands (cannot use process.kill() for one-file Python executables since Tauri only knows the pid of the PyInstaller bootloader process and not its' child process which is actually the sidecar).
40+
- In `main.rs` we spawn a python binary (sidecar) called `main.exe` which starts an api server on `localhost:8008`. The frontend tells Tauri to startup and shutdown the sidecar via stdin/stdout commands. <em>Note, we cannot use process.kill() for one-file Python executables since Tauri only knows the pid of the PyInstaller bootloader process and not its' child process (which is actually the sidecar)</em>.
4241

4342
- If you are not comfortable coding in Rust, do not worry, this example orchestrates things in a way so you only need concern yourself with communication between your frontend and server (sidecar) via http.
4443

@@ -54,7 +53,7 @@ This should give you everything you need to build a local, native application th
5453

5554
- IPC communication between frontend (javascript) and Tauri (Rust) framework.
5655

57-
- Also control this app from an external UI source like another website. As long as it uses http(s) and you whitelist the url in the server config `main.py`.
56+
- Also control this app from an external UI source like another website, app or terminal. As long as it uses http(s) and you whitelist the url in the server config `main.py`.
5857

5958
## Project Structure
6059

@@ -136,6 +135,8 @@ A note on compiling Python exe (the -F flag bundles everything into one .exe). Y
136135
Build the production app for a specific OS:
137136

138137
```bash
138+
# Uses `pnpm build:sidecar-winos` by default
139+
# Modify script for your target OS
139140
pnpm tauri build
140141
```
141142

@@ -151,7 +152,7 @@ And the raw executable here:
151152

152153
- Pass parameters to the sidecar (like server port) via a frontend form.
153154

154-
- Pass argument `--dev-sidecar` to `pnpm tauri dev` script that tells Tauri to run sidecars in "dev mode". This would allow for running the python code from the python interpreter installed on your machine rather than having to manually run `pnpm build:sidecar-[os]` each time you make changes to the Python code.
155+
- Pass argument `--dev-sidecar` to `pnpm tauri dev` script that tells Tauri to run sidecars in "dev mode". This would allow for running the python code from the python interpreter installed on your machine rather than having to manually compile with `pnpm build:sidecar-[os]` each time you make changes to the Python code.
155156

156157
- Develop a standalone multi-sidecar manager that can handle startup/shutdown and communication between all other sidecars spawned in the app.
157158

0 commit comments

Comments
 (0)