fix(start-macos): skip pip install when requirements.txt is unchanged (#2503)
Hash requirements.txt on each launch and skip pip install if the hash matches the last recorded value. Cuts 10-20s from warm starts with no change to what gets installed. The hash file lives in venv/.requirements_hash (already gitignored). Deleting venv/ or changing requirements.txt triggers a full reinstall.
This commit is contained in:
@@ -134,10 +134,17 @@ if [ ! -d venv ]; then
|
|||||||
"$PY" -m venv venv
|
"$PY" -m venv venv
|
||||||
fi
|
fi
|
||||||
VENV_PY="./venv/bin/python3"
|
VENV_PY="./venv/bin/python3"
|
||||||
echo "▶ Installing Python packages (first run downloads a few — can take a few minutes)…"
|
REQ_HASH="$(md5 -q requirements.txt 2>/dev/null || md5sum requirements.txt | cut -d' ' -f1)"
|
||||||
"$VENV_PY" -m pip install --quiet --upgrade pip
|
REQ_HASH_FILE="venv/.requirements_hash"
|
||||||
# Not --quiet: this is the slow step, so show progress (and any real errors).
|
if [ ! -f "$REQ_HASH_FILE" ] || [ "$REQ_HASH" != "$(cat "$REQ_HASH_FILE" 2>/dev/null)" ]; then
|
||||||
"$VENV_PY" -m pip install -r requirements.txt
|
echo "▶ Installing Python packages (first run downloads a few — can take a few minutes)…"
|
||||||
|
"$VENV_PY" -m pip install --quiet --upgrade pip
|
||||||
|
# Not --quiet: this is the slow step, so show progress (and any real errors).
|
||||||
|
"$VENV_PY" -m pip install -r requirements.txt
|
||||||
|
echo "$REQ_HASH" > "$REQ_HASH_FILE"
|
||||||
|
else
|
||||||
|
echo "▶ Python packages up to date — skipping install"
|
||||||
|
fi
|
||||||
|
|
||||||
# chromadb-client (HTTP-only) conflicts with the full chromadb package. If
|
# chromadb-client (HTTP-only) conflicts with the full chromadb package. If
|
||||||
# it got installed (e.g., from an older requirements-optional.txt), remove
|
# it got installed (e.g., from an older requirements-optional.txt), remove
|
||||||
|
|||||||
Reference in New Issue
Block a user