Build & Distribution
Ship your TauPy application as a ready-to-run package.
1. Quick path: one command
What happens:
1. Frontend - runs npm run build if package.json is present (skipped otherwise).
2. Backend - bundles main.py with Nuitka (onefile by default).
3. Launcher - copies taupy.exe and WebView2Loader.dll.
4. Packaging - writes everything into ./target/.
Resulting layout:
target/
app.exe # bundled backend
dist/ # static assets (React/Vite output, client.js)
launcher/
taupy.exe
WebView2Loader.dll
2. Prerequisites
| Tool | Why | Notes |
|---|---|---|
| Python 3.9+ | Backend build | Same version as dev recommended |
| Nuitka | Bundle backend | pip install nuitka |
| Node.js (optional) | Build React/Vite | Required only if package.json exists |
| Rust toolchain (optional) | Custom launcher | Needed only if you rebuild the launcher yourself |
Check setup:
3. Configure the build
Settings live in taupy.toml (generated by taupy new). Key sections:
[build]
onefile = true # bundle backend into a single exe
strip = true # strip symbols (smaller binaries)
[build.modules]
# extra Python modules Nuitka should include explicitly
numpy = true
Common flags:
- onefile: true for a single EXE; set to false for dir mode if AV tools are aggressive.
- strip: remove debug symbols to shrink output.
- [build.modules]: list modules that Nuitka might miss during import detection.
Frontend-related:
- If package.json exists, taupy build runs npm run build.
- To skip frontend build, temporarily move or rename package.json (or delete it in CI after building yourself).
4. Dev vs production serving
- Dev (
taupy dev): usually usesTAUPY_EXTERNAL_HTTP=1so the launcher loads Vite on5173; WebSocket defaults to8765. - Build/Prod (
taupy build):AppMode.RAW_HTMLservesdist/via the launcher's tiny HTTP server. Keepexternal_http = falseintaupy.tomlso assets load locally. - Override ports via env vars:
TAUPY_HTTP_PORT,TAUPY_WS_PORT. In production you normally do not setTAUPY_EXTERNAL_HTTP.
5. Step-by-step release workflow
1) Clean and install deps
pip install -U -r requirements.txt # or poetry install
pip install nuitka
npm install # if React/Vite
2) Build frontend (optional)
This writes assets intodist/.
3) Build TauPy bundle
Find output intarget/.
4) Test the packaged app
5) Distribute
- Zip the target/ folder, or
- Wrap it with an installer (MSI, Inno Setup, NSIS), or
- Copy app.exe, dist/, and launcher/ into your deployment pipeline.
6. What is inside the bundle
launcher/taupy.exe: Rust + WebView2 host that opens the desktop window.launcher/WebView2Loader.dll: loader for the WebView2 runtime.dist/: static assets for raw HTML or React builds (includesclient.jsfor Python widgets).app.exe: Nuitka-compiled backend (contains Python, your code, and dependencies).
7. Customizing the launcher
Default builds reuse the prebuilt launcher. If you need to patch it:
Then replacelauncher/taupy.exe in your project (and keep WebView2Loader.dll).
8. Code-signing and AV friendliness
- Onefile vs dir mode: If antivirus tools flag
app.exe, setonefile = falseto produce a directory build. - Signing: Sign
app.exeandlauncher/taupy.exewith your code-signing certificate aftertaupy build. - WebView2: End users need the WebView2 runtime (most Windows 11 systems have it; installer link: https://go.microsoft.com/fwlink/p/?LinkId=2124703).
9. Troubleshooting
nuitka not found: install withpip install nuitkain the active environment.npm run buildfails: fix React errors first; ensure Node and npm versions match yourpackage.jsonengines.- Port already in use during build preview: set
TAUPY_HTTP_PORTor stop the conflicting process. - WebSocket not connecting in packaged app: ensure firewall allows localhost
8765; avoid settingTAUPY_EXTERNAL_HTTPin production. - Blank window in prod: check that
dist/exists next toapp.exeandlauncher/, and thatexternal_httpisfalse.
10. CI tips
- Cache
node_modulesand.venv/.cachefor faster builds. - Run
npm run buildandtaupy buildas separate steps; fail fast on lint/type errors. - Store
target/as an artifact and run smoke tests launchingapp.exeheadless if possible.