-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathdev_setup.sh
More file actions
45 lines (38 loc) · 1017 Bytes
/
dev_setup.sh
File metadata and controls
45 lines (38 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -euo pipefail
VENV_DIR=".venv"
# Pick a Python command that exists
if command -v python3 >/dev/null 2>&1; then
PY=python3
elif command -v python >/dev/null 2>&1; then
PY=python
elif command -v py >/dev/null 2>&1; then
PY="py -3"
else
echo "❌ Python not found. Install Python 3 and try again."
exit 1
fi
# Create venv only if missing
if [ ! -d "$VENV_DIR" ]; then
eval $PY -m venv "$VENV_DIR"
fi
# Activate (Linux/Mac = bin; Windows = Scripts)
if [ -f "$VENV_DIR/bin/activate" ]; then
# shellcheck source=/dev/null
source "$VENV_DIR/bin/activate"
elif [ -f "$VENV_DIR/Scripts/activate" ]; then
# shellcheck source=/dev/null
source "$VENV_DIR/Scripts/activate"
else
echo "❌ Could not find activate script in $VENV_DIR"
exit 1
fi
# Upgrade pip
python -m pip install --upgrade pip
# Install deps if present
if [ -f "requirements.txt" ]; then
pip install -r requirements.txt
else
echo "ℹ️ No requirements.txt — skipping"
fi
echo "✅ Environment Ready"