build(client): use locked uv environment in launcher and Docker
This commit is contained in:
+10
-19
@@ -2,8 +2,8 @@
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
VENV_DIR="$ROOT_DIR/.venv"
|
||||
REQ_FILE="$ROOT_DIR/s2s-client/requirements.txt"
|
||||
CLIENT_DIR="$ROOT_DIR/s2s-client"
|
||||
VENV_DIR="$CLIENT_DIR/.venv"
|
||||
FRONTEND_DIR="$ROOT_DIR/s2s-frontend"
|
||||
if [ -f "$ROOT_DIR/.env" ]; then
|
||||
set -a
|
||||
@@ -20,7 +20,7 @@ if (( BASH_VERSINFO[0] < 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 4) ))
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for required_command in python3 node npm setsid curl; do
|
||||
for required_command in uv node npm setsid curl; do
|
||||
if ! command -v "$required_command" >/dev/null 2>&1; then
|
||||
echo "Error: $required_command was not found."
|
||||
exit 1
|
||||
@@ -46,22 +46,13 @@ if [ "$UI_PORT" = "$S2S_BACKEND_PORT" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$VENV_DIR" ]; then
|
||||
echo "Creating the virtual environment in .venv..."
|
||||
python3 -m venv "$VENV_DIR"
|
||||
fi
|
||||
|
||||
source "$VENV_DIR/bin/activate"
|
||||
|
||||
if [ ! -f "$REQ_FILE" ]; then
|
||||
echo "Error: requirements file was not found: $REQ_FILE"
|
||||
if [ ! -f "$CLIENT_DIR/pyproject.toml" ] || [ ! -f "$CLIENT_DIR/uv.lock" ]; then
|
||||
echo "Error: s2s-client/pyproject.toml and s2s-client/uv.lock are required."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! python -c "import fastapi, uvicorn, httpx, dotenv, websockets" >/dev/null 2>&1; then
|
||||
echo "Installing dependencies from s2s-client/requirements.txt..."
|
||||
python -m pip install -r "$REQ_FILE"
|
||||
fi
|
||||
# uv manages only the client environment; an existing root speech venv is separate.
|
||||
UV_PROJECT_ENVIRONMENT="$VENV_DIR" uv sync --project "$CLIENT_DIR" --locked
|
||||
|
||||
# Keep restarts offline when the installed frontend manifests have not changed.
|
||||
if [ ! -f "$FRONTEND_DIR/node_modules/vite/bin/vite.js" ] || \
|
||||
@@ -118,10 +109,10 @@ echo " Press Ctrl+C in this terminal to stop both servers."
|
||||
echo "----------------------------------------------------"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
setsid "$VENV_DIR/bin/python" -m uvicorn server:app \
|
||||
--app-dir "$ROOT_DIR/s2s-client" \
|
||||
setsid "$VENV_DIR/bin/python" -m uvicorn s2s_client.main:app \
|
||||
--app-dir "$CLIENT_DIR" \
|
||||
--host 127.0.0.1 --port "$S2S_BACKEND_PORT" \
|
||||
--reload --reload-dir "$ROOT_DIR/s2s-client" &
|
||||
--reload --reload-dir "$CLIENT_DIR" &
|
||||
backend_pid=$!
|
||||
child_pids+=("$backend_pid")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user