From 214ab25b3cb4609f6ac00d7f6a857d6fdd8af582 Mon Sep 17 00:00:00 2001 From: Otto-AGPT Date: Wed, 11 Feb 2026 17:26:35 +0000 Subject: [PATCH] fix: Install poetry via pipx (Python feature provides pipx, not poetry) The Python devcontainer feature installs pipx but not poetry by default. Updated to: 1. Add poetry to toolsToInstall in devcontainer.json 2. Use pipx to install poetry in oncreate.sh 3. Ensure PATH includes /usr/local/py-utils/bin where pipx installs tools --- .devcontainer/platform/devcontainer.json | 3 +- .devcontainer/platform/scripts/oncreate.sh | 33 +++++++++++--------- .devcontainer/platform/scripts/postcreate.sh | 8 ++--- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.devcontainer/platform/devcontainer.json b/.devcontainer/platform/devcontainer.json index 660d186de6..a0c4709c66 100644 --- a/.devcontainer/platform/devcontainer.json +++ b/.devcontainer/platform/devcontainer.json @@ -20,7 +20,8 @@ }, "ghcr.io/devcontainers/features/python:1": { "version": "3.13", - "installTools": true + "installTools": true, + "toolsToInstall": "flake8,autopep8,black,mypy,pytest,poetry" } }, diff --git a/.devcontainer/platform/scripts/oncreate.sh b/.devcontainer/platform/scripts/oncreate.sh index c529a24733..af83e003c4 100755 --- a/.devcontainer/platform/scripts/oncreate.sh +++ b/.devcontainer/platform/scripts/oncreate.sh @@ -17,6 +17,21 @@ set -x # Print commands for debugging echo "🚀 Starting prebuild setup..." +# ============================================================================= +# Install Poetry via pipx (pipx is installed by the Python devcontainer feature) +# ============================================================================= +echo "📦 Installing Poetry..." + +# pipx is installed by the Python feature at /usr/local/py-utils/bin +export PATH="/usr/local/py-utils/bin:$PATH" + +if ! command -v poetry &> /dev/null; then + pipx install poetry +fi + +# Verify poetry is available +poetry --version + # Workspace is autogpt_platform cd /workspaces/AutoGPT/autogpt_platform @@ -27,13 +42,6 @@ echo "📦 Installing backend dependencies..." cd backend -# Install Poetry if not present -if ! command -v poetry &> /dev/null; then - echo "Installing Poetry..." - curl -sSL https://install.python-poetry.org | python3 - - export PATH="$HOME/.local/bin:$PATH" -fi - # Install Python dependencies poetry install --no-interaction --no-ansi @@ -51,7 +59,7 @@ echo "📦 Installing frontend dependencies..." cd frontend -# Install pnpm if not present +# pnpm should be installed by the Node feature, but ensure it's available if ! command -v pnpm &> /dev/null; then echo "Installing pnpm..." npm install -g pnpm @@ -88,9 +96,6 @@ wait echo "✅ Dependency images pulled" -# NOTE: We intentionally do NOT build backend/frontend images here. -# Those need to use the current branch's code, not prebuild's code. - # ============================================================================= # Copy environment files # ============================================================================= @@ -122,12 +127,10 @@ echo "✅ PREBUILD COMPLETE" echo "==============================================" echo "" echo "Cached:" -echo " ✅ Python packages (poetry)" +echo " ✅ Poetry (via pipx)" +echo " ✅ Python packages" echo " ✅ Node packages (pnpm)" echo " ✅ Dependency Docker images" echo "" -echo "NOT cached (intentionally):" -echo " ❌ Backend/Frontend containers (would have stale code)" -echo "" echo "The postcreate script will start services." echo "" diff --git a/.devcontainer/platform/scripts/postcreate.sh b/.devcontainer/platform/scripts/postcreate.sh index dcf0ba71d7..bb1fd049ab 100755 --- a/.devcontainer/platform/scripts/postcreate.sh +++ b/.devcontainer/platform/scripts/postcreate.sh @@ -13,6 +13,9 @@ set -e # Exit on error echo "🚀 Setting up your development environment..." +# Ensure PATH includes pipx binaries (where poetry is installed) +export PATH="/usr/local/py-utils/bin:$PATH" + cd /workspaces/AutoGPT/autogpt_platform # ============================================================================= @@ -65,9 +68,6 @@ echo "🔄 Running database migrations..." cd backend -# Ensure Poetry is in PATH -export PATH="$HOME/.local/bin:$PATH" - # Run migrations poetry run prisma migrate deploy poetry run prisma generate @@ -127,5 +127,5 @@ echo "🔑 Test Account:" echo " Email: test123@gmail.com" echo " Password: testpassword123" echo "" -echo "📚 Full docs: .devcontainer/README.md" +echo "📚 Full docs: .devcontainer/platform/README.md" echo ""