-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (85 loc) · 2.97 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
SHELL := bash
# This is the version of python used for local development
PYTHON_VERSION := 3.8
# Setup your venv and install dependencies for local devel
install:
{ python$(PYTHON_VERSION) -m venv venv || py -$(PYTHON_VERSION) -m venv venv ; } && \
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
{ pip3 install --upgrade pip || echo ""; } && \
pip3 install\
-r requirements.txt\
-e '.[all]' && \
localstack-s3-pyspark configure-defaults && \
{ mypy --install-types --non-interactive || echo '' ; } && \
echo "Success!"
# Install dependencies needed to run CI/CD
ci-install:
{ python3 -m venv venv || py -3 -m venv venv ; } && \
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
{ pip3 install --upgrade pip wheel || echo ""; } && \
pip3 install\
-r requirements.txt\
-e '.[all]' && \
echo "Success!"
# Rebuild your virtual environment from scratch
reinstall:
{ rm -R venv || echo "" ; } && \
{ python$(PYTHON_VERSION) -m venv venv || py -$(PYTHON_VERSION) -m venv venv ; } && \
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
pip3 install --upgrade pip && \
pip3 install daves-dev-tools isort flake8 mypy black tox pytest -e '.[all]' && \
localstack-s3-pyspark configure-defaults && \
{ mypy --install-types --non-interactive || echo '' ; } && \
echo "Success!"
make requirements && \
echo "Installation complete"
# Cleanup unused packages, and Git-ignored files (such as build files)
clean:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
daves-dev-tools uninstall-all\
-e .\
-e pyproject.toml\
-e tox.ini\
-e requirements.txt && \
daves-dev-tools clean && \
echo "Success!"
# Distribute to PYPI
distribute:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
daves-dev-tools distribute --skip-existing && \
echo "Success!"
# Upgrade
upgrade:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
daves-dev-tools requirements freeze\
-nv '*' '.[all]' pyproject.toml tox.ini daves-dev-tools isort flake8 mypy black tox pytest \
> .requirements.txt && \
pip3 install --upgrade --upgrade-strategy eager\
-r .requirements.txt '.[all]' && \
rm .requirements.txt && \
make requirements
# Update requirement version #'s to match the current environment
requirements:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
daves-dev-tools requirements update\
-i pyspark\
-aen all\
setup.cfg pyproject.toml tox.ini && \
daves-dev-tools requirements freeze\
-e pip\
-e wheel\
-nv setuptools -nv filelock -nv platformdirs\
. pyproject.toml tox.ini daves-dev-tools\
> requirements.txt && \
echo "Success!"
# Run all tests
test:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
if [[ "$$(python -V)" = "Python $(PYTHON_VERSION)."* ]] ;\
then tox run -r ;\
else tox run -r --skip-env 'black|mypy|isort|flake8' ;\
fi
# Apply formatting requirements and perform checks
format:
{ . venv/bin/activate || venv/Scripts/activate.bat ; } && \
black . && isort . && flake8 && mypy