-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_env.bash
48 lines (42 loc) · 1.19 KB
/
setup_env.bash
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
46
47
48
#!/bin/bash
HELP_MESSAGE="Usage: ./build.sh [-r, --rebuild]
Build the '${IMAGE_NAME}' image.
Options:
-r, --rebuild Remove the previous venv completely before rebuilding
-h, --help Show this help message."
# Parse input flags
BUILD_FLAGS=()
rebuild=false
while [ "$#" -gt 0 ]; do
case "$1" in
-r | --rebuild)
rebuild=true
shift 1
;;
-h | --help)
echo "${HELP_MESSAGE}"
exit 0
;;
*)
echo "Unknown option: $1" >&2
exit 1
;;
esac
done
# Check if we need to remove past files and caches
if [ "$rebuild"=true ] ; then
echo "Removing previous venv..."
rm -rf .venv
echo "Done"
fi
echo "Creating venv..."
python3.9 -m venv .venv # Create venv (use any python version you like >=3.9)
echo "Done"
echo "Activating venv..."
source .venv/bin/activate # Activate venv
echo "Done"
echo "Installing python libraries"
pip install --upgrade pip # We need the latest version to have editable mode with a .toml
pip install -r requirements.txt # Install package requirements
python3.9 -m build # Build package
python3.9 -m pip install -e . # Install package. -e for editable, developer mode.