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
This commit is contained in:
Otto-AGPT
2026-02-11 17:26:35 +00:00
parent 4daa25e3dc
commit 214ab25b3c
3 changed files with 24 additions and 20 deletions

View File

@@ -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 ""

View File

@@ -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 ""