You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use of "sidecars" is to allow developers to package dependencies to make installation easier on the user. Tauriallows 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.
- 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).
38
37
39
38
-[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.
40
39
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>.
42
41
43
42
- 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.
44
43
@@ -54,7 +53,7 @@ This should give you everything you need to build a local, native application th
54
53
55
54
- IPC communication between frontend (javascript) and Tauri (Rust) framework.
56
55
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`.
58
57
59
58
## Project Structure
60
59
@@ -136,6 +135,8 @@ A note on compiling Python exe (the -F flag bundles everything into one .exe). Y
136
135
Build the production app for a specific OS:
137
136
138
137
```bash
138
+
# Uses `pnpm build:sidecar-winos` by default
139
+
# Modify script for your target OS
139
140
pnpm tauri build
140
141
```
141
142
@@ -151,7 +152,7 @@ And the raw executable here:
151
152
152
153
- Pass parameters to the sidecar (like server port) via a frontend form.
153
154
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.
155
156
156
157
- Develop a standalone multi-sidecar manager that can handle startup/shutdown and communication between all other sidecars spawned in the app.
0 commit comments