-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-venv.sh
executable file
·34 lines (26 loc) · 1.12 KB
/
setup-venv.sh
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
#!/usr/bin/env bash
POSIXLY_CORRECT=1 set -o errexit && set -o nounset && set -o pipefail && unset POSIXLY_CORRECT
# This script uses relative paths. To avoid errors, make sure this script's
# working directory is the project's root.
cd "$(dirname $0)" && test -f .project-root-dir
echo "Re-create virtual environment"
if [ ! -d .venv ]; then
echo "Create venv in .venv directory and install pip, wheel, setuptools, and pip-tools."
/usr/bin/python3.8 -m venv --copies --clear .venv
# shellcheck disable=SC1090
fi
# shellcheck disable=SC1090
source .venv/bin/activate
pip install 'pip==20.2.4'
pip install 'pip-tools==5.3.1'
pip install 'wheel==0.35.1'
pip install 'setuptools==50.3.2'
echo "Run pip-sync"
pip-sync requirements.txt
echo "Run 'pip check' to detect broken requirements"
pip check
# PyCharm has trouble handling requirements that start with `git` as produced by `pip-compile`.
# pip freeze makes sure the format becomes `mypackage @ git...` which
# PyCharm can handle.
echo "# This requirements file was autogenerated by $(basename $0) script" > requirements-for-pycharm.txt
pip freeze >> requirements-for-pycharm.txt