@echo off setlocal EnableExtensions pushd "%~dp0" echo [1/4] Check Python 3.11 ... where py >nul 2>&1 if %errorlevel%==0 ( set "PYTHON=py -3.11" ) else ( set "PYTHON=python" ) %PYTHON% --version if %errorlevel% neq 0 ( echo ERROR: Python 3.11 not found. popd pause exit /b 1 ) echo [2/4] Install build dependencies ... %PYTHON% -m pip install -r requirements.txt if %errorlevel% neq 0 ( echo ERROR: Failed to install dependencies. popd pause exit /b 1 ) echo [3/4] Check required files ... if not exist "runner.py" ( echo ERROR: runner.py not found. popd pause exit /b 1 ) if not exist "license.lic" ( echo ERROR: license.lic not found. popd pause exit /b 1 ) if not exist "public_key.pem" ( echo ERROR: public_key.pem not found. popd pause exit /b 1 ) if not exist "entry.cp311-win_amd64.pyd" ( echo ERROR: entry.cp311-win_amd64.pyd not found. popd pause exit /b 1 ) if exist "entry.py" ( echo ERROR: Found entry.py - remove source files before building. echo Keep only entry.cp311-win_amd64.pyd popd pause exit /b 1 ) if exist "data_clean.py" ( echo ERROR: Found data_clean.py - remove algorithm source files before building. popd pause exit /b 1 ) echo [4/4] Build api_runner.exe ... if exist "runner.dist" rmdir /s /q "runner.dist" if exist "runner.build" rmdir /s /q "runner.build" set "NUITKA_CACHE_DIR=%TEMP%\nuitka-cache" %PYTHON% -m nuitka runner.py ^ --standalone ^ --jobs=1 ^ --lto=no ^ --assume-yes-for-downloads ^ --output-filename=api_runner.exe ^ --include-package=cryptography ^ --include-package=numpy ^ --include-package=pandas ^ --include-package=scipy ^ --include-package=matplotlib ^ --enable-plugin=matplotlib ^ --include-module=numpy.testing ^ --nofollow-import-to=tkinter ^ --nofollow-import-to=matplotlib.tests ^ --nofollow-import-to=pandas.tests ^ --nofollow-import-to=scipy.tests ^ --include-data-files=entry.cp311-win_amd64.pyd=entry.cp311-win_amd64.pyd ^ --include-data-files=license.lic=license.lic ^ --include-data-files=public_key.pem=public_key.pem if %errorlevel% neq 0 ( echo. echo ERROR: Build failed. popd pause exit /b 1 ) echo. echo SUCCESS: runner.dist\api_runner.exe echo Electron will auto-detect runner.dist folder. echo Next: cd to project root and run "npm run electron:dev" popd pause endlocal