-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlaunch-native.bat
More file actions
39 lines (35 loc) · 2.65 KB
/
Copy pathlaunch-native.bat
File metadata and controls
39 lines (35 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@echo off
echo QuantUI NATIVE MODE — Local conda env in WSL, no container
echo Use this when you have edited quantui/*.py and want to test immediately.
echo.
REM Repo root is one level up from this launchers/ folder; convert it to a WSL
REM path for portability.
for %%i in ("%~dp0..") do set "REPO=%%~fi"
for /f "delims=" %%i in ('wsl wslpath -a "%REPO%"') do set WSLPATH=%%i
REM Runs Voila directly from the quantui conda env inside WSL.
REM pip install -e . is skipped when pyproject.toml has not changed since the
REM last install (.dev_install_stamp). quantui/*.py changes are always live in
REM editable mode — reinstall is only needed after pyproject.toml changes or on
REM first use.
REM Uses port 8867 to avoid conflict with container-based launchers on 8866.
REM Clears quantui/__pycache__ on every launch to prevent stale .pyc bytecode
REM (WSL2 DrvFs does not reliably propagate Windows-side mtime changes, so Python
REM may load pre-edit bytecode even after source changes — see GOTCHAS.md).
REM PYTHONDONTWRITEBYTECODE=1 prevents a new stale cache from accumulating.
REM The editable reinstall MUST NOT block launch when offline: pip fetches
REM build deps (setuptools) from PyPI, which hangs/fails with no network. So it
REM runs with a short timeout + no retries, is non-fatal, and the chain
REM continues to Voila with `; ` (not `&&`) regardless. It also stamps
REM .dev_install_stamp even when skipped, so a one-time pyproject change can't
REM make EVERY subsequent offline launch retry (and re-delay on) pip — the
REM reinstall is attempted once, then skipped. quantui/*.py + package-data are
REM live in editable mode, so a skipped reinstall is harmless offline; re-run
REM `pip install -e .` manually when online if you add a real dependency.
start "QuantUI [native]" wsl -d Ubuntu -- bash -c "cd '%WSLPATH%' && for c in ~/miniforge3 ~/miniconda3 ~/anaconda3 /opt/conda; do [ -f $c/etc/profile.d/conda.sh ] && . $c/etc/profile.d/conda.sh && break; done && conda activate quantui && if [ pyproject.toml -nt .dev_install_stamp ] || ! python -c 'import quantui' 2>/dev/null; then pip install -e . -q --timeout=5 --retries=0 && touch .dev_install_stamp || { echo '[QuantUI] editable reinstall skipped (offline?) - using live source'; touch .dev_install_stamp; }; fi; rm -rf quantui/__pycache__ && PYTHONDONTWRITEBYTECODE=1 voila notebooks/molecule_computations.ipynb --no-browser --port=8867 --ServerApp.disable_check_xsrf=True"
echo Waiting for Voila to start...
timeout /t 6 /nobreak > nul
start http://localhost:8867
echo.
echo Native dev server running at http://localhost:8867
echo All local quantui/*.py changes are live — no rebuild needed.
echo Close the WSL window to stop.