From 49adbe26ec113ab0d2b3f59d86d5f91b34420bf4 Mon Sep 17 00:00:00 2001 From: Petr Date: Sun, 15 Mar 2026 00:59:45 +0100 Subject: [PATCH] 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). --- docs/setup/bootstrap.yaml | 7 ++++++- scripts/sync_data.sh | 20 +++----------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/docs/setup/bootstrap.yaml b/docs/setup/bootstrap.yaml index d98d3ab..19d942b 100644 --- a/docs/setup/bootstrap.yaml +++ b/docs/setup/bootstrap.yaml @@ -51,11 +51,16 @@ steps: - "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." - - 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: - "python3 -m venv .venv" - "source .venv/bin/activate" - "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" condition: "only if server/scripts/setup_views.sh exists" diff --git a/scripts/sync_data.sh b/scripts/sync_data.sh index 6cd4bc5..6023c07 100755 --- a/scripts/sync_data.sh +++ b/scripts/sync_data.sh @@ -491,23 +491,9 @@ else echo " [dry-run] Would sync corporate memory rules to .claude/rules/" fi -# Sync Python environment to server (only if dependencies changed) -if [[ -z "$DRY_RUN" ]] && [[ -f "./.venv/bin/pip" ]]; then - echo "" - 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 +# Note: Python environment on server is set up during bootstrap (not synced). +# Server venv is created via: ssh {alias} 'python3 -m venv ~/.venv && pip install ...' +# This avoids cross-platform pip freeze issues (Windows/macOS -> Linux). # Only update DuckDB and check freshness if NOT dry-run if [[ -z "$DRY_RUN" ]]; then