dev-setup.sh
bash
sha256:f46000eb75b553410e84488d043c1b0303ff96ed1e336623529171962005cb2f
update dev setup.sh
Human
minor
⚠ breaking
3 days ago
| 1 | #!/usr/bin/env bash |
| 2 | # dev-setup.sh — set up the muse local development environment. |
| 3 | # |
| 4 | # Nukes and rebuilds .venv from scratch, installs muse in editable mode |
| 5 | # with all grammars and dev tools, and symlinks the binary to ~/bin/muse. |
| 6 | # |
| 7 | # Run this once after cloning and again any time dependencies drift: |
| 8 | # bash dev-setup.sh |
| 9 | # |
| 10 | # The ~/bin/muse symlink stays valid across rebuilds because it points to |
| 11 | # .venv/bin/muse, which pip regenerates on every editable install. |
| 12 | |
| 13 | set -euo pipefail |
| 14 | |
| 15 | REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 16 | VENV="$REPO/.venv" |
| 17 | BIN_LINK="$HOME/bin/muse" |
| 18 | PYTHON="${PYTHON:-python3.14}" |
| 19 | |
| 20 | log() { printf '\033[1;34m%s\033[0m\n' "$*"; } |
| 21 | ok() { printf '\033[1;32m✅ %s\033[0m\n' "$*"; } |
| 22 | die() { printf '\033[1;31m❌ %s\033[0m\n' "$*" >&2; exit 1; } |
| 23 | |
| 24 | # ── 1. Verify Python ────────────────────────────────────────────────────────── |
| 25 | |
| 26 | log "[1/5] Checking Python" |
| 27 | command -v "$PYTHON" >/dev/null 2>&1 || die "$PYTHON not found. Install Python 3.14+." |
| 28 | PY_VERSION=$("$PYTHON" -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") |
| 29 | [[ "$PY_VERSION" == 3.14* ]] || die "Python 3.14 required, found $PY_VERSION." |
| 30 | ok "Python $PY_VERSION at $("$PYTHON" -c 'import sys; print(sys.executable)')" |
| 31 | |
| 32 | # ── 2. Rebuild venv ─────────────────────────────────────────────────────────── |
| 33 | |
| 34 | log "[2/5] Rebuilding .venv (clean)" |
| 35 | rm -rf "$VENV" |
| 36 | "$PYTHON" -m venv "$VENV" |
| 37 | ok ".venv created" |
| 38 | |
| 39 | # ── 3. Install muse (editable + all extras) ─────────────────────────────────── |
| 40 | |
| 41 | log "[3/5] Installing muse[all,dev] in editable mode" |
| 42 | "$VENV/bin/pip" install --quiet --upgrade pip |
| 43 | "$VENV/bin/pip" install --quiet -e "$REPO[all,dev]" |
| 44 | ok "muse installed" |
| 45 | |
| 46 | # ── 4. Verify critical extras resolved correctly ───────────────────────────── |
| 47 | |
| 48 | log "[4/5] Verifying HTTP/2 dependency chain" |
| 49 | |
| 50 | H2=$("$VENV/bin/python" -c "import h2; print(h2.__version__)" 2>/dev/null || true) |
| 51 | [[ -n "$H2" ]] || die "h2 not installed — httpx[http2] extras chain is broken." |
| 52 | ok "h2 $H2" |
| 53 | |
| 54 | HTTPCORE=$("$VENV/bin/pip" show httpcore | grep "^Version" | awk '{print $2}') |
| 55 | ok "httpcore $HTTPCORE" |
| 56 | |
| 57 | HTTPX=$("$VENV/bin/pip" show httpx | grep "^Version" | awk '{print $2}') |
| 58 | ok "httpx $HTTPX (http2 extras resolved)" |
| 59 | |
| 60 | # ── 5. Symlink binary ───────────────────────────────────────────────────────── |
| 61 | |
| 62 | log "[5/5] Symlinking binary" |
| 63 | mkdir -p "$(dirname "$BIN_LINK")" |
| 64 | ln -sf "$VENV/bin/muse" "$BIN_LINK" |
| 65 | ok "~/bin/muse -> $VENV/bin/muse" |
| 66 | |
| 67 | # ── Done ────────────────────────────────────────────────────────────────────── |
| 68 | |
| 69 | printf '\n' |
| 70 | log "Dev environment ready." |
| 71 | log " muse: $("$VENV/bin/muse" --version)" |
| 72 | log " venv: $VENV" |
| 73 | log " binary: $BIN_LINK" |
| 74 | printf '\n' |
| 75 | log "To dog-food the user install path (from staging.musehub.ai):" |
| 76 | log " curl -fsSL https://staging.musehub.ai/install.sh | sh" |
| 77 | log "That installs to ~/.local/share/muse/venv — a separate env, no conflict." |
| 78 | |
| 79 | # testing |
File History
1 commit
sha256:f46000eb75b553410e84488d043c1b0303ff96ed1e336623529171962005cb2f
update dev setup.sh
Human
minor
⚠
3 days ago