Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,28 @@ uv sync --dev
cd ..
```

### Build The Sidecar

macOS/Linux:

```bash
bash scripts/build-sidecar.sh
```

Windows PowerShell:

```powershell
.\scripts\build-sidecar.ps1
```

### Run The App

```bash
npm run tauri dev
```

The first desktop run expects the packaged sidecar resource to exist. After building it once, `npm run tauri dev` starts the frontend and launches the local backend dev process.

### Run Frontend Only

```bash
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,27 @@ uv sync --dev
cd ..
```

Build the packaged sidecar resource once:

macOS/Linux:

```bash
bash scripts/build-sidecar.sh
```

Windows PowerShell:

```powershell
.\scripts\build-sidecar.ps1
```

Then run:

```bash
npm run tauri dev
```

The Tauri shell starts the frontend and launches the Python backend sidecar/dev process.
The first desktop run expects the packaged sidecar resource to exist. After building it once, the Tauri shell starts the frontend and launches the Python backend sidecar/dev process.

### Before Opening An Issue

Expand All @@ -309,6 +323,8 @@ The Tauri shell starts the frontend and launches the Python backend sidecar/dev
| --- | --- |
| Frontend dev server | `npm run dev` |
| Desktop dev app | `npm run tauri dev` |
| Build sidecar on macOS/Linux | `bash scripts/build-sidecar.sh` |
| Build sidecar on Windows | `.\scripts\build-sidecar.ps1` |
| TypeScript check | `npm run typecheck` |
| Frontend tests | `npm test` |
| Frontend build | `npm run build` |
Expand Down
25 changes: 18 additions & 7 deletions scripts/build-sidecar.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
set -euo pipefail

cd "$(dirname "$0")/.."
REPO_ROOT="$(pwd)"
TARGET_DIR="src-tauri/resources/backend"

export UV_CACHE_DIR="$REPO_ROOT/backend/.uv-cache"
export PYTHONNOUSERSITE="1"
export PYINSTALLER_CONFIG_DIR="$REPO_ROOT/backend/.pyinstaller-cache"
export HF_HOME="$REPO_ROOT/backend/.hf-cache"

echo "Building Python sidecar..."
rm -rf "$TARGET_DIR"
rm -f "${TARGET_DIR}.exe"

cd backend
uv run pyinstaller backend.spec --distpath ../src-tauri/resources --noconfirm
uv run pyinstaller backend.spec --distpath ../src-tauri/resources/backend --noconfirm --clean
cd ..

echo "Sidecar built at: $TARGET_DIR"
echo "Rename the binary for Tauri's triple-target naming..."

TRIPLE=$(rustc -vV | grep 'host:' | awk '{print $2}')
TRIPLE="$(rustc -vV | awk '/host:/ {print $2}')"

if [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "win"* ]]; then
SRC="$TARGET_DIR/backend.exe"
Expand All @@ -22,6 +28,11 @@ else
DST="$TARGET_DIR/backend-${TRIPLE}"
fi

if [[ ! -f "$SRC" ]]; then
echo "Expected sidecar was not created: $SRC" >&2
exit 1
fi

cp "$SRC" "$DST"
chmod +x "$DST" 2>/dev/null || true
echo "Sidecar ready: $DST"