mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2025-12-05 19:17:52 -06:00
Simplified .envrc to use the existing root venv (bin/ directory) instead of creating nested .venv Updated .tinyrc to point to root directory Ensures direnv properly activates the virtual environment with all installed packages
31 lines
853 B
Bash
31 lines
853 B
Bash
# 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}"
|