Repository navigation
Unify install scripts: root delegates to src/scripts/install.sh (#534) - #537
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the root install.sh (the curl | bash entrypoint) to delegate dependency installation to src/scripts/install.sh, aiming to consolidate install logic into a single comprehensive installer.
Changes:
- Replaces the root script’s dependency installation step with a call to
src/scripts/install.sh(with an npm-install fallback if missing). - Removes the root script’s inline Python/GPU dependency handling in favor of the delegated installer.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cd src | ||
| npm install --no-audit --no-fund 2>&1 | tail -3 | ||
| echo " ✅ Node dependencies installed" | ||
|
|
||
| # Python training dependencies (for Academy LoRA fine-tuning + plasticity compaction) | ||
| # Install torch first (needed for GPU detection), then training deps if GPU available | ||
| if command -v python3 &>/dev/null; then | ||
| PIP_FLAGS="" | ||
| # Python 3.12+ requires --break-system-packages for system pip | ||
| if python3 -c "import sys; exit(0 if sys.version_info >= (3,12) else 1)" 2>/dev/null; then | ||
| PIP_FLAGS="--break-system-packages" | ||
| fi | ||
|
|
||
| # Ensure torch is installed (needed for GPU detection and inference) | ||
| if ! python3 -c "import torch" 2>/dev/null; then | ||
| echo " 📦 Installing PyTorch..." | ||
| python3 -m pip install --quiet $PIP_FLAGS torch 2>&1 | tail -3 | ||
| fi | ||
|
|
||
| HAS_GPU=false | ||
| if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then | ||
| HAS_GPU=true | ||
| fi | ||
|
|
||
| if [ "$HAS_GPU" = true ]; then | ||
| echo " 🧠 GPU detected — installing training + compaction dependencies..." | ||
| python3 -m pip install --quiet $PIP_FLAGS \ | ||
| unsloth \ | ||
| peft \ | ||
| transformers \ | ||
| bitsandbytes \ | ||
| datasets \ | ||
| trl \ | ||
| tensorboard \ | ||
| huggingface_hub \ | ||
| safetensors \ | ||
| 2>&1 | tail -3 | ||
| echo " ✅ Training dependencies installed (Unsloth + PEFT + LoRA + compaction)" | ||
| else | ||
| echo " ⚠️ No GPU detected — skipping training dependencies (inference still works)" | ||
| fi | ||
| if [ -f "scripts/install.sh" ]; then | ||
| bash scripts/install.sh | ||
| else |
There was a problem hiding this comment.
Running the comprehensive src/scripts/install.sh from the root installer changes the behavior of the public curl | bash entrypoint: it will now (via the delegated script) install Tailscale and modify local PostgreSQL auth (e.g., swapping scram-sha-256 to trust). If this is intended, the root installer should explicitly warn users; if not, consider adding opt-in/opt-out flags (env vars) and passing them here to avoid unexpected security-impacting changes during installation.
| # ─── Step 4: Full Install via comprehensive installer ──────────────── | ||
| # src/scripts/install.sh handles ALL platform-specific dependencies: | ||
| # PostgreSQL, build-essential, CUDA, Python ML stack, Node deps, Rust build | ||
| echo "📋 Step 4: Running full installer" | ||
| echo "-----------------------------------" | ||
| cd src | ||
| npm install --no-audit --no-fund 2>&1 | tail -3 | ||
| echo " ✅ Node dependencies installed" | ||
|
|
||
| # Python training dependencies (for Academy LoRA fine-tuning + plasticity compaction) | ||
| # Install torch first (needed for GPU detection), then training deps if GPU available | ||
| if command -v python3 &>/dev/null; then | ||
| PIP_FLAGS="" | ||
| # Python 3.12+ requires --break-system-packages for system pip | ||
| if python3 -c "import sys; exit(0 if sys.version_info >= (3,12) else 1)" 2>/dev/null; then | ||
| PIP_FLAGS="--break-system-packages" | ||
| fi | ||
|
|
||
| # Ensure torch is installed (needed for GPU detection and inference) | ||
| if ! python3 -c "import torch" 2>/dev/null; then | ||
| echo " 📦 Installing PyTorch..." | ||
| python3 -m pip install --quiet $PIP_FLAGS torch 2>&1 | tail -3 | ||
| fi | ||
|
|
||
| HAS_GPU=false | ||
| if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then | ||
| HAS_GPU=true | ||
| fi | ||
|
|
||
| if [ "$HAS_GPU" = true ]; then | ||
| echo " 🧠 GPU detected — installing training + compaction dependencies..." | ||
| python3 -m pip install --quiet $PIP_FLAGS \ | ||
| unsloth \ | ||
| peft \ | ||
| transformers \ | ||
| bitsandbytes \ | ||
| datasets \ | ||
| trl \ | ||
| tensorboard \ | ||
| huggingface_hub \ | ||
| safetensors \ | ||
| 2>&1 | tail -3 | ||
| echo " ✅ Training dependencies installed (Unsloth + PEFT + LoRA + compaction)" | ||
| else | ||
| echo " ⚠️ No GPU detected — skipping training dependencies (inference still works)" | ||
| fi | ||
| if [ -f "scripts/install.sh" ]; then | ||
| bash scripts/install.sh |
There was a problem hiding this comment.
This step claims the root installer is delegating dependency handling to the comprehensive installer, but the root script still installs Node/Rust/Postgres/build tools earlier and then calls the comprehensive installer that repeats those checks/installs. That undermines the “one source of truth” goal and can lead to redundant work and subtle divergence. Consider trimming the root installer to a minimal bootstrap (git/curl + clone) and then hand off to src/scripts/install.sh for the rest (or otherwise avoid overlapping responsibilities).
| # Fallback: basic npm install if comprehensive script not found | ||
| npm install --no-audit --no-fund 2>&1 | tail -3 | ||
| echo " ✅ Node dependencies installed" |
There was a problem hiding this comment.
In the fallback path, npm install ... | tail -3 can mask a failing npm install because the script does not enable pipefail (only set -e). That can cause the installer to continue into npm start with incomplete dependencies. Consider enabling set -o pipefail for the script (or avoid piping the npm install output) so install failures reliably stop the installer.
Root install.sh now delegates to the comprehensive src/scripts/install.sh instead of duplicating dep handling. One source of truth.