herolib_python/env.sh
2025-08-05 15:15:36 +02:00

32 lines
863 B
Bash
Executable File

#!/bin/bash
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "Setting up Herolib environment in: $SCRIPT_DIR"
# Check if uv is installed
if ! command -v uv &> /dev/null; then
echo "❌ uv is not installed. Please install uv first:"
echo " curl -LsSf https://astral.sh/uv/install.sh | sh"
echo " or visit: https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
echo "✅ uv found: $(uv --version)"
# Create virtual environment if it doesn't exist
if [ ! -d ".venv" ]; then
echo "📦 Creating Python virtual environment..."
uv venv
echo "✅ Virtual environment created"
else
echo "✅ Virtual environment already exists"
fi
# Activate virtual environment
echo "🔄 Activating virtual environment..."
source .venv/bin/activate