# TinyTorch Virtual Environment Auto-Activation
# This uses the root-level venv (bin/ directory)

# The virtual environment is at the project root
VENV_PATH="${PWD}"

# Check if bin/activate exists
if [[ ! -f "${VENV_PATH}/bin/activate" ]]; then
    echo "❌ Virtual environment not found at ${VENV_PATH}"
    echo "Run: python3 -m venv ${VENV_PATH}"
    exit 1
fi

# Activate the virtual environment
source "${VENV_PATH}/bin/activate"

# Set common Python environment variables
export PYTHONPATH="${PWD}:${PYTHONPATH}"
export PROJECT_ROOT="${PWD}"
export VENV_PATH

# Prevent Python from writing pyc files
export PYTHONDONTWRITEBYTECODE=1

# Enable Python development mode (more detailed error messages)
export PYTHONDEVMODE=1

echo "✅ TinyTorch environment activated"
echo "🐍 Python: $(python --version)"
echo "📍 Virtual env: ${VIRTUAL_ENV}"
