diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 011a124e5..20b74bb96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,15 +36,7 @@ jobs: - name: Install Tauri dependencies run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf python3 - - - name: Setup Python sidecar binary - run: | - TARGET=$(rustc --print host-tuple) - PYTHON_PATH=$(which python3) - SIDECAR_PATH="src-tauri/runtime-skill-python-${TARGET}" - ln -sf "${PYTHON_PATH}" "${SIDECAR_PATH}" - echo "Created symlink: ${SIDECAR_PATH} -> ${PYTHON_PATH}" + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf - name: Cache Cargo registry uses: actions/cache@v4 diff --git a/.github/workflows/package-and-publish.yml b/.github/workflows/package-and-publish.yml index bc289d8f2..f54a02343 100644 --- a/.github/workflows/package-and-publish.yml +++ b/.github/workflows/package-and-publish.yml @@ -199,7 +199,7 @@ jobs: if: matrix.settings.platform == 'ubuntu-22.04' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf python3 + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf - name: Install OpenMP (macOS only) if: matrix.settings.platform == 'macos-latest' @@ -207,25 +207,6 @@ jobs: brew install libomp echo "OpenMP installed for llama-cpp-sys build" - - name: Setup Python sidecar binary (Linux) - if: matrix.settings.platform == 'ubuntu-22.04' - run: | - TARGET=$(rustc --print host-tuple) - PYTHON_PATH=$(which python3) - SIDECAR_PATH="src-tauri/runtime-skill-python-${TARGET}" - ln -sf "${PYTHON_PATH}" "${SIDECAR_PATH}" - echo "Created symlink: ${SIDECAR_PATH} -> ${PYTHON_PATH}" - - - name: Setup Python sidecar binary (macOS) - if: matrix.settings.platform == 'macos-latest' - run: | - # Extract target from args (e.g., "--target aarch64-apple-darwin" -> "aarch64-apple-darwin") - TARGET=$(echo "${{ matrix.settings.args }}" | grep -oE '(aarch64|x86_64)-apple-darwin' || rustc --print host-tuple) - PYTHON_PATH=$(which python3 || which python) - SIDECAR_PATH="src-tauri/runtime-skill-python-${TARGET}" - ln -sf "${PYTHON_PATH}" "${SIDECAR_PATH}" - echo "Created symlink: ${SIDECAR_PATH} -> ${PYTHON_PATH}" - - name: Cache Cargo registry uses: actions/cache@v4 with: diff --git a/scripts/setup-python-sidecar.mjs b/scripts/setup-python-sidecar.mjs deleted file mode 100644 index 738508126..000000000 --- a/scripts/setup-python-sidecar.mjs +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env node -/** - * Symlink system python3 to src-tauri/runtime-skill-python- for local dev. - * Run from project root: node scripts/setup-python-sidecar.mjs - */ -import { execSync } from 'child_process'; -import fs from 'fs'; -import path from 'path'; -import { fileURLToPath } from 'url'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const root = path.resolve(__dirname, '..'); -const binariesDir = path.join(root, 'src-tauri'); - -function getTargetTriple() { - try { - return execSync('rustc --print host-tuple', { encoding: 'utf8' }).trim(); - } catch { - const out = execSync('rustc -Vv', { encoding: 'utf8' }); - const m = out.match(/host:\s*(.+)/); - if (m) return m[1].trim(); - throw new Error('Could not get Rust target triple (rustc not found?)'); - } -} - -function getSystemPython() { - const isWin = process.platform === 'win32'; - try { - const cmd = isWin ? 'where python' : 'which python3'; - const out = execSync(cmd, { encoding: 'utf8' }).trim(); - const first = out.split(/[\r\n]/)[0].trim(); - if (first) return first; - } catch {} - throw new Error( - 'System Python not found. Install Python 3 and ensure python3 (or python on Windows) is on PATH.' - ); -} - -const target = getTargetTriple(); -const ext = process.platform === 'win32' ? '.exe' : ''; -const sidecarName = `runtime-skill-python-${target}${ext}`; -const sidecarPath = path.join(binariesDir, sidecarName); -const systemPython = getSystemPython(); - -try { - if (fs.existsSync(sidecarPath)) { - fs.unlinkSync(sidecarPath); - } - fs.symlinkSync(systemPython, sidecarPath); - console.log(`Linked ${sidecarName} -> ${systemPython}`); -} catch (err) { - console.error(err.message); - process.exit(1); -} diff --git a/src-tauri/binaries/README.md b/src-tauri/binaries/README.md deleted file mode 100644 index 0edb65495..000000000 --- a/src-tauri/binaries/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Tauri sidecar binaries - -The app bundles a Python interpreter as a sidecar for skill runtimes (`runtime-skill-python`). The binary lives in `src-tauri/` (next to `tauri.conf.json`) and must be named by target triple. - -## Required file - -- **Python**: `src-tauri/runtime-skill-python-` (e.g. `runtime-skill-python-aarch64-apple-darwin`, or `runtime-skill-python-x86_64-pc-windows-msvc.exe` on Windows) - -Get your target triple: - -```bash -rustc --print host-tuple -``` - -## Local development (symlink to system Python) - -From the project root: - -```bash -node scripts/setup-python-sidecar.mjs -``` - -This creates a symlink at `src-tauri/runtime-skill-python-` pointing to your system `python3`. - -## Production / bundled Python - -For a standalone app that does not rely on the user having Python installed: - -1. **Windows**: Use the [Python embeddable package](https://www.python.org/downloads/windows/). Copy `python.exe` to `src-tauri/runtime-skill-python-x86_64-pc-windows-msvc.exe` (and the same for `aarch64-pc-windows-msvc` if you support ARM). You may need to bundle the rest of the embeddable folder as resources and set `PYTHONHOME` when spawning. - -2. **macOS / Linux**: Use [python-build-standalone](https://github.com/astral-sh/python-build-standalone/releases). Copy the `bin/python3` from the extracted tree to `src-tauri/runtime-skill-python-`. Note: the binary may have dynamic library dependencies; for a fully portable build you may need to bundle the whole distribution as resources. - -After adding the binary, run `yarn tauri build` (or `yarn tauri dev`); the sidecar will be included in the bundle.