From 21989dadaedb35c9a411d998e92944958fa8c875 Mon Sep 17 00:00:00 2001 From: Jeremy McClure Date: Thu, 6 Aug 2026 05:16:01 -0400 Subject: [PATCH 1/3] Use uv for isolated Python venv in bin/ and .venv/ - install.sh: downloads uv to bin/, creates .venv/ via uv venv, installs deps - start.sh: uses .venv/bin/python3 directly, syncs deps via bin/uv - .gitignore: added .venv/ and bin/ - Removes global pip3 usage, all Python deps stay project-local --- .gitignore | 2 ++ install.sh | 36 +++++++++++++++++++++++++++++------- start.sh | 27 ++++++++++++++++++++------- 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index b757d55..8d0b5f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ __pycache__/ *.pyc .env +.venv/ +bin/ *.egg-info/ dist/ node_modules/ diff --git a/install.sh b/install.sh index de32e91..40a5453 100755 --- a/install.sh +++ b/install.sh @@ -17,19 +17,41 @@ echo "Detected OS: $OS" if command -v python3 &>/dev/null; then echo "Python: $(python3 --version)" else - echo "ERROR: Python 3.10+ required. Install via: sudo apt install python3 python3-pip" + echo "ERROR: Python 3.10+ required. Install via: sudo apt install python3" exit 1 fi -# Check pip -if ! command -v pip3 &>/dev/null; then - echo "Installing pip..." - python3 -m ensurepip --upgrade +# Install uv into bin/ if not present +BIN_DIR="bin" +UV="$BIN_DIR/uv" +if [ -x "$UV" ]; then + echo "uv: $($UV --version)" +else + echo "Installing uv to $BIN_DIR/..." + mkdir -p "$BIN_DIR" + curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$PWD/$BIN_DIR" sh + if [ ! -x "$UV" ]; then + echo "ERROR: uv installation failed. Install manually: curl -LsSf https://astral.sh/uv/install.sh | sh" + exit 1 + fi + echo "uv: $($UV --version)" + # Remove shell helper scripts — we reference bin/uv directly + rm -f "$BIN_DIR/env" "$BIN_DIR/env.fish" fi -# Install Python deps +# Create virtual environment +VENV_DIR=".venv" +if [ -d "$VENV_DIR" ]; then + echo "Virtual environment already exists at $VENV_DIR/" +else + echo "Creating virtual environment..." + "$UV" venv "$VENV_DIR" + echo "Created $VENV_DIR/" +fi + +# Install Python deps into venv echo "Installing Python dependencies..." -pip3 install -r requirements.txt --quiet +"$UV" pip install --python "$VENV_DIR/bin/python3" -r requirements.txt --quiet # Check Node.js (for opencode) if command -v node &>/dev/null; then diff --git a/start.sh b/start.sh index 8dea07b..e1c22d6 100755 --- a/start.sh +++ b/start.sh @@ -10,18 +10,31 @@ if [ ! -f server.py ]; then exit 1 fi -# Check dependencies -pip3 install -r requirements.txt --quiet 2>/dev/null +# Check virtual environment +VENV_DIR=".venv" +if [ ! -d "$VENV_DIR" ]; then + echo "Virtual environment not found. Run ./install.sh first." + exit 1 +fi + +# Use venv Python directly (no shell activation needed) +PYTHON="$VENV_DIR/bin/python3" + +# Ensure deps are up to date +UV="bin/uv" +if [ -x "$UV" ]; then + "$UV" pip install --python "$PYTHON" -r requirements.txt --quiet 2>/dev/null +else + "$PYTHON" -m pip install -r requirements.txt --quiet 2>/dev/null +fi # Get port from settings or default PORT=8080 -if command -v python3 &>/dev/null; then - PORT=$(python3 -c "import json; f=open('data/settings.json'); d=json.load(f); print(d.get('dashboard',{}).get('port',8080)); f.close()" 2>/dev/null || echo "8080") -fi +PORT=$("$PYTHON" -c "import json; f=open('data/settings.json'); d=json.load(f); print(d.get('dashboard',{}).get('port',8080)); f.close()" 2>/dev/null || echo "8080") echo "Dashboard: http://127.0.0.1:${PORT}" echo "Press Ctrl+C to stop" echo "" -# Start server -python3 server.py --port "${PORT}" +# Start server using venv Python +"$PYTHON" server.py --port "${PORT}" From 54ae2d5dc50a3f332c62d2a7444cdfaf77e7ad72 Mon Sep 17 00:00:00 2001 From: Jeremy McClure Date: Thu, 6 Aug 2026 05:21:14 -0400 Subject: [PATCH 2/3] Fix stale pip references, update README prerequisites for uv - README: prerequisites table now notes uv auto-installs Python deps - scheduler.py: error message points to ./install.sh instead of pip install - start.sh: removed stderr suppression on pip fallback so errors are visible --- README.md | 2 +- scheduler/scheduler.py | 2 +- start.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b733e2a..91ade96 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ chmod +x install.sh && ./install.sh | Tool | Required? | Install | |------|-----------|---------| -| Python 3.10+ | ✅ Required | `sudo apt install python3 python3-pip` | +| Python 3.10+ | ✅ Required | Auto-installed via `uv` by `install.sh` | | Node.js 18+ | ⚠ For opencode | `curl -fsSL https://deb.nodesource.com/setup_20.x \| sudo bash - && sudo apt install -y nodejs` | | opencode | ⚠ For code tasks | `npm install -g @opencode/cli` | | Hermes Agent | ⚠ For memory/scheduling | `curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh \| bash` | diff --git a/scheduler/scheduler.py b/scheduler/scheduler.py index 0d9d217..963935d 100644 --- a/scheduler/scheduler.py +++ b/scheduler/scheduler.py @@ -151,7 +151,7 @@ class CronScheduler: from apscheduler.schedulers.background import BackgroundScheduler as BS from apscheduler.triggers.cron import CronTrigger as CT except ImportError: - print("Install APScheduler: pip install apscheduler") + print("APScheduler not found. Run ./install.sh to install dependencies.") return self._scheduler = BS() self._reload_jobs() diff --git a/start.sh b/start.sh index e1c22d6..80d5be1 100755 --- a/start.sh +++ b/start.sh @@ -23,9 +23,9 @@ PYTHON="$VENV_DIR/bin/python3" # Ensure deps are up to date UV="bin/uv" if [ -x "$UV" ]; then - "$UV" pip install --python "$PYTHON" -r requirements.txt --quiet 2>/dev/null + "$UV" pip install --python "$PYTHON" -r requirements.txt --quiet else - "$PYTHON" -m pip install -r requirements.txt --quiet 2>/dev/null + "$PYTHON" -m pip install -r requirements.txt --quiet fi # Get port from settings or default From 0cd8ca0e7251c3ace247ab2dcbb9da5fc8e80b05 Mon Sep 17 00:00:00 2001 From: Jeremy McClure Date: Thu, 6 Aug 2026 05:22:52 -0400 Subject: [PATCH 3/3] Pin Python 3.12 as default in uv venv creation --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 40a5453..47bec66 100755 --- a/install.sh +++ b/install.sh @@ -45,7 +45,7 @@ if [ -d "$VENV_DIR" ]; then echo "Virtual environment already exists at $VENV_DIR/" else echo "Creating virtual environment..." - "$UV" venv "$VENV_DIR" + "$UV" venv "$VENV_DIR" --python 3.12 echo "Created $VENV_DIR/" fi