mirror of
https://github.com/kuhyx/wake-alarm.git
synced 2026-11-10 18:07:05 +01:00
ci_mirror: build the clean venv with uv (18.3 s -> 2.1 s cold)
The venv rebuild after a requirements.txt change was the largest cold-path cost of `scripts/check_gate_stamp.sh full`. uv is also what CI installs with, so the mirror gets closer to CI, not further. The interpreter is passed as a path: `--python python3` let uv pick an active ~/.venv (3.13) that crdt-sync 0.9.2 (>=3.14) cannot install into. pip stays as fallback. Measured under capped.sh (4G, 20 %): `full` warm 10.9 s; fully cold (no venv, empty PRE_COMMIT_HOME, empty mypy cache) 45.9 s, floor = the pylint hook env install (~24 s, only after .pre-commit-config.yaml changes). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xfj1sxKH9VBPqpcAni8Jry
This commit is contained in:
parent
4f149e67a4
commit
7e40bb138c
@ -64,6 +64,20 @@ ensure_venv() {
|
||||
|
||||
log "requirements.txt changed — rebuilding clean venv (mirrors CI install)"
|
||||
rm -rf "$VENV_DIR"
|
||||
# uv is what CI installs with (`uv pip install -r`), and it rebuilt this
|
||||
# venv in 2.1 s where venv + pip took 18.3 s (2026-10-16) -- the largest
|
||||
# cold-path cost of `check_gate_stamp.sh full`. pip stays as the fallback.
|
||||
if command -v uv >/dev/null 2>&1; then
|
||||
# A PATH, not the bare name: `--python python3` let uv prefer an
|
||||
# active ~/.venv (3.13) over the python3 the pip path would use.
|
||||
uv venv --quiet --python "$(command -v python3)" "$VENV_DIR" \
|
||||
|| fail "uv venv for the clean venv"
|
||||
uv pip install --quiet --python "$VENV_DIR/bin/python" -r "$REQ_PATH" \
|
||||
|| fail "uv pip install -r $REQUIREMENTS_FILE (a dep may be undeclared)"
|
||||
printf '%s' "$current" > "$HASH_FILE"
|
||||
log "clean venv ready (uv)"
|
||||
return
|
||||
fi
|
||||
python3 -m venv "$VENV_DIR"
|
||||
"$VENV_DIR/bin/python" -m pip install --quiet --upgrade pip \
|
||||
|| fail "pip self-upgrade in the clean venv"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user