This project ships as a hybrid app: Electron frontend + Python backend. Packaging is two steps:
- Build the Python backend with PyInstaller
- Build the Electron app with electron-builder
- Node.js
- Python
- Virtual environment
backend_envat repo root
Important: use backend_env for PyInstaller. Do not use Anaconda base. It will massively bloat the build.
# Enter backend dir
cd src/backend
# Activate dedicated venv (repo root)
..\..\backend_env\Scripts\activate
# Build backend
..\..\backend_env\Scripts\python -m PyInstaller origin-backend.spec -yOutput directory:
src/backend/dist/origin_backend/
# Back to repo root
cd ../..
# Build full app
npm run build:winOutput:
dist/LmNotebook Setup 1.0.0.exe
| Environment | Result |
|---|---|
backend_env |
Minimal dependencies, backend ~20-30MB |
| Anaconda base | Huge bundle (often 500MB+) |
This repo uses directory mode (exclude_binaries=True + COLLECT):
- Faster startup (no self-extract)
- Output:
dist/origin_backend/
One-file mode is not used by default (--onefile), because it slows startup.
package.json includes:
"extraResources": [
{
"from": "src/backend/dist/origin_backend",
"to": "backend",
"filter": ["**/*"]
}
]Runtime backend path:
resources/backend/origin_backend.exe
cd src/backend ; ..\..\backend_env\Scripts\activate ; ..\..\backend_env\Scripts\python -m PyInstaller origin-backend.spec -y ; cd ../.. ; npm run build:win