Move server venv setup to bootstrap, remove cross-platform pip freeze sync

Server venv is created during bootstrap via SSH (same package list,
installed natively on Linux). Removes sync_data.sh section that copied
pip freeze output across platforms (Windows/macOS freeze is incompatible
with Linux).
This commit is contained in:
Petr 2026-03-15 00:59:45 +01:00
parent 22a1bb5847
commit 49adbe26ec
2 changed files with 9 additions and 18 deletions

View file

@ -51,11 +51,16 @@ steps:
- "rsync -avz --no-perms --no-group --progress {ssh_alias}:server/parquet/ ./server/parquet/" - "rsync -avz --no-perms --no-group --progress {ssh_alias}:server/parquet/ ./server/parquet/"
note: "Some folders may be empty if data sync hasn't run on the server yet. That's OK." note: "Some folders may be empty if data sync hasn't run on the server yet. That's OK."
- name: "Set up Python venv" - name: "Set up Python venv (local and server)"
description: |
Set up local venv, then create a matching venv on the server via SSH.
The server venv is needed for running scripts remotely (notifications, etc.).
Install the SAME packages on both sides (do NOT copy pip freeze across platforms).
commands: commands:
- "python3 -m venv .venv" - "python3 -m venv .venv"
- "source .venv/bin/activate" - "source .venv/bin/activate"
- "pip install pandas pyarrow duckdb pyyaml python-dotenv" - "pip install pandas pyarrow duckdb pyyaml python-dotenv"
- "ssh {ssh_alias} 'python3 -m venv ~/.venv && ~/.venv/bin/pip install --quiet pandas pyarrow duckdb pyyaml python-dotenv'"
- name: "Initialize DuckDB" - name: "Initialize DuckDB"
condition: "only if server/scripts/setup_views.sh exists" condition: "only if server/scripts/setup_views.sh exists"

View file

@ -491,23 +491,9 @@ else
echo " [dry-run] Would sync corporate memory rules to .claude/rules/" echo " [dry-run] Would sync corporate memory rules to .claude/rules/"
fi fi
# Sync Python environment to server (only if dependencies changed) # Note: Python environment on server is set up during bootstrap (not synced).
if [[ -z "$DRY_RUN" ]] && [[ -f "./.venv/bin/pip" ]]; then # Server venv is created via: ssh {alias} 'python3 -m venv ~/.venv && pip install ...'
echo "" # This avoids cross-platform pip freeze issues (Windows/macOS -> Linux).
LOCAL_REQ="$(mktemp)"
./.venv/bin/pip freeze > "$LOCAL_REQ"
LOCAL_HASH=$(md5sum "$LOCAL_REQ" 2>/dev/null | cut -d' ' -f1 || md5 -q "$LOCAL_REQ" 2>/dev/null || echo "none")
REMOTE_HASH=$(ssh $SSH_HOST "md5sum ~/.analyst_requirements.txt 2>/dev/null | cut -d' ' -f1 || echo 'missing'" 2>/dev/null || echo "missing")
if [[ "$LOCAL_HASH" != "$REMOTE_HASH" ]]; then
echo "Syncing Python environment to server..."
scp "$LOCAL_REQ" "$SSH_HOST:~/.analyst_requirements.txt"
ssh $SSH_HOST "test -d ~/.venv || python3 -m venv ~/.venv; ~/.venv/bin/pip install -r ~/.analyst_requirements.txt --quiet 2>&1 | tail -1"
echo "Server Python environment synced"
else
echo "Server Python environment up to date"
fi
rm -f "$LOCAL_REQ"
fi
# Only update DuckDB and check freshness if NOT dry-run # Only update DuckDB and check freshness if NOT dry-run
if [[ -z "$DRY_RUN" ]]; then if [[ -z "$DRY_RUN" ]]; then