@@ -3,55 +3,120 @@ set -euo pipefail
33
44SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
55VENV_DIR=" ${SCRIPT_DIR} /.venv"
6+ DISABLE_VENV=false
67
7- echo " Setting up local development environment..."
8+ while [[ $# -gt 0 ]]; do
9+ case $1 in
10+ --disable-venv)
11+ DISABLE_VENV=true
12+ shift
13+ ;;
14+ * )
15+ echo " Unknown option: $1 " >&2
16+ exit 1
17+ ;;
18+ esac
19+ done
820
9- if command -v pyenv & > /dev/null; then
10- PYTHON_VERSION=" $( cat " ${SCRIPT_DIR} /.python-version" ) "
11- echo " Python version from .python-version: ${PYTHON_VERSION} "
12- echo " Installing Python ${PYTHON_VERSION} via pyenv..."
13- pyenv install -s " ${PYTHON_VERSION} "
21+ # shellcheck source=deploy/002-setup/lib/common.sh
22+ source " ${SCRIPT_DIR} /deploy/002-setup/lib/common.sh"
23+
24+ # Preamble: Recommend devcontainer for easier setup
25+ echo
26+ echo " 💡 RECOMMENDED: Use the Dev Container for the best experience."
27+ echo
28+ echo " The devcontainer includes all tools pre-configured:"
29+ echo " • Azure CLI, Terraform, kubectl, helm, jq"
30+ echo " • Python with all dependencies"
31+ echo " • VS Code extensions for Terraform and Python"
32+ echo
33+ echo " To use:"
34+ echo " VS Code → Reopen in Container (F1 → Dev Containers: Reopen)"
35+ echo " Codespaces → Open in Codespace from GitHub"
36+ echo
37+ echo " If this script fails, the devcontainer is your fallback."
38+ echo
39+
40+ section " Tool Verification"
41+
42+ require_tools az terraform kubectl helm jq
43+ info " All required tools found"
44+
45+ section " Python Environment Setup"
46+
47+ PYTHON_VERSION=" $( cat " ${SCRIPT_DIR} /.python-version" ) "
48+ info " Target Python version: ${PYTHON_VERSION} "
49+
50+ if command -v pyenv & > /dev/null; then
51+ info " Installing Python ${PYTHON_VERSION} via pyenv..."
52+ pyenv install -s " ${PYTHON_VERSION} "
53+ PYTHON_CMD=" python"
54+ elif command -v python3 & > /dev/null; then
55+ warn " pyenv not found, using system python3"
56+ PYTHON_CMD=" python3"
57+ else
58+ fatal " Neither pyenv nor python3 found. Please install Python 3.11+"
1459fi
1560
16- echo " Using pyenv Python $( python --version) "
61+ info " Using Python: $( $PYTHON_CMD --version) "
1762
18- if [[ ! -d " ${VENV_DIR} " ]]; then
19- echo " Creating virtual environment at ${VENV_DIR} ..."
20- python -m venv " ${VENV_DIR} "
63+ if [[ " ${DISABLE_VENV} " == " true" ]]; then
64+ info " Virtual environment disabled, installing packages directly..."
2165else
22- echo " Virtual environment already exists at ${VENV_DIR} "
66+ if [[ ! -d " ${VENV_DIR} " ]]; then
67+ info " Creating virtual environment at ${VENV_DIR} ..."
68+ $PYTHON_CMD -m venv " ${VENV_DIR} "
69+ else
70+ info " Virtual environment already exists at ${VENV_DIR} "
71+ fi
72+ info " Activating virtual environment..."
73+ source " ${VENV_DIR} /bin/activate"
2374fi
2475
25- echo " Activating virtual environment ..."
26- source " ${VENV_DIR} /bin/activate "
76+ info " Upgrading pip ..."
77+ pip install --upgrade pip --quiet
2778
28- echo " Upgrading pip..."
29- pip install --upgrade pip
79+ info " Installing root dependencies..."
80+ if ! pip install -r " ${SCRIPT_DIR} /requirements.txt" --quiet 2> /dev/null; then
81+ warn " Some packages failed to install (expected on macOS for Linux-only packages)"
82+ fi
3083
31- echo " Installing root dependencies..."
32- pip install -r " ${SCRIPT_DIR} /requirements.txt"
84+ info " Installing training dependencies..."
85+ if ! pip install -r " ${SCRIPT_DIR} /src/training/requirements.txt" --quiet 2> /dev/null; then
86+ warn " Some training packages failed to install"
87+ fi
3388
34- echo " Installing training dependencies..."
35- pip install -r " ${SCRIPT_DIR} /src/training/requirements.txt"
89+ section " IsaacLab Setup"
3690
37- echo " "
38- echo " Setting up IsaacLab for local development..."
3991ISAACLAB_DIR=" ${SCRIPT_DIR} /external/IsaacLab"
4092
4193if [[ -d " ${ISAACLAB_DIR} " ]]; then
42- echo " IsaacLab already cloned at ${ISAACLAB_DIR} "
43- echo " To update, run: cd ${ISAACLAB_DIR} && git pull"
94+ info " IsaacLab already cloned at ${ISAACLAB_DIR} "
95+ info " To update, run: cd ${ISAACLAB_DIR} && git pull"
4496else
45- echo " Cloning IsaacLab for intellisense/Pylance support..."
46- mkdir -p " ${SCRIPT_DIR} /external"
47- git clone https://github.com/isaac-sim/IsaacLab.git " ${ISAACLAB_DIR} "
48- echo " ✓ IsaacLab cloned successfully"
97+ info " Cloning IsaacLab for intellisense/Pylance support..."
98+ mkdir -p " ${SCRIPT_DIR} /external"
99+ git clone https://github.com/isaac-sim/IsaacLab.git " ${ISAACLAB_DIR} "
100+ info " IsaacLab cloned successfully"
49101fi
50102
51- echo " "
52- echo " ✓ Development environment setup complete!"
53- echo " "
54- echo " To activate the environment, run:"
55- echo " source .venv/bin/activate"
56- echo " "
57- echo " Python path: ${VENV_DIR} /bin/python"
103+ section " Setup Complete"
104+
105+ echo
106+ echo " ✅ Development environment setup complete!"
107+ echo
108+ if [[ " ${DISABLE_VENV} " == " false" ]]; then
109+ warn " Run this command to activate the virtual environment:"
110+ echo
111+ echo " source .venv/bin/activate"
112+ echo
113+ fi
114+ echo " Next steps:"
115+ echo " 1. Run: source deploy/000-prerequisites/az-sub-init.sh"
116+ echo " 2. Configure: deploy/001-iac/terraform.tfvars"
117+ echo " 3. Deploy: cd deploy/001-iac && terraform init && terraform apply"
118+ echo
119+ echo " Documentation:"
120+ echo " - README.md - Quick start guide"
121+ echo " - deploy/README.md - Deployment overview"
122+ echo
0 commit comments