Skip to content

Commit d8f640d

Browse files
committed
📜 feat: Add setup script for venv creation
* Introduced to automate the creation of a Python virtual environment. * The script checks for the existence of a specified requirements file, removes any existing virtual environment, and installs dependencies from the requirements file. * Provides instructions for activating the virtual environment after setup.
1 parent d776d22 commit d8f640d

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎setup_venv.sh‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
VENV_DIR="$SCRIPT_DIR/venv"
6+
REQ_FILE="${1:-requirements.lite.txt}"
7+
8+
if [[ ! -f "$SCRIPT_DIR/$REQ_FILE" ]]; then
9+
echo "Error: $SCRIPT_DIR/$REQ_FILE not found"
10+
exit 1
11+
fi
12+
13+
echo "==> Removing old venv (if any)..."
14+
rm -rf "$VENV_DIR"
15+
16+
echo "==> Creating fresh venv..."
17+
python3 -m venv "$VENV_DIR"
18+
19+
echo "==> Upgrading pip..."
20+
"$VENV_DIR/bin/pip" install --upgrade pip --quiet
21+
22+
echo "==> Installing from $REQ_FILE..."
23+
"$VENV_DIR/bin/pip" install -r "$SCRIPT_DIR/$REQ_FILE"
24+
25+
echo ""
26+
echo "Done! Activate with:"
27+
echo " source $VENV_DIR/bin/activate"

0 commit comments

Comments
 (0)