# -*- mode: python ; coding: utf-8 -*- """PyInstaller spec for the Moxie bench sidecar. Build (on the target machine, inside the repo root): pip install -r bench/requirements.txt pyinstaller cd frontend && bun install && bun run build:bench:release && cd .. pyinstaller bench/moxie_bench.spec Output: dist/moxie-bench/ (onedir - ships moxie-bench(.exe) plus _internal/) Tauri 2 sidecar wiring (see bench/tauri/README.md): - copy dist/moxie-bench/ next to your Tauri binary as `moxie-bench/` - point externalBin / or spawn `moxie-bench/moxie-bench --port ` - poll http://127.0.0.1:/api/health until {"ok": true} """ import os from pathlib import Path repo_root = Path(SPECPATH).resolve().parent # bench/ -> repo root hiddenimports = [ "uvicorn.logging", "uvicorn.loops", "uvicorn.loops.auto", "uvicorn.protocols", "uvicorn.protocols.http", "uvicorn.protocols.http.auto", "uvicorn.protocols.websockets", "uvicorn.protocols.websockets.auto", "uvicorn.lifespan", "uvicorn.lifespan.on", "anyio._backends._asyncio", ] a = Analysis( ["bench/run.py"], pathex=[str(repo_root / "bench")], binaries=[], datas=[ # the prebuilt bench UI + base workflow travel with the binary (str(repo_root / "bench" / "ui-dist"), "bench/ui-dist"), (str(repo_root / "bench" / "base_workflow.json"), "bench"), ], hiddenimports=hiddenimports, hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=["torch", "comfy", "comfy_execution", "folder_paths"], noarchive=False, ) pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, [], exclude_binaries=True, name="moxie-bench", debug=False, bootloader_ignore_signals=False, strip=False, upx=False, console=True, # sidecar logs are useful; Tauri can hide the window ) coll = COLLECT( exe, a.binaries, a.datas, strip=False, upx=False, name="moxie-bench", )