-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (44 loc) · 1.43 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
BIN=venv/bin/
PYTHON=.$(BIN)/python
BASE_REQUIREMENTS = requirements/requirements-base.in
DEV_REQUIREMENTS = requirements/requirements-dev.in
ENV_NAME = reports
conda_create:
conda create -n $(ENV_NAME) -y
conda_update:
conda env update -n $(ENV_NAME) --file environment.yml --prune
venv:
python -m venv venv
clean:
rm -rf venv
find . -name "*.pyc" -exec rm -f {} \;
install_requirements:
$(BIN)pip install -r $(BASE_REQUIREMENTS)
install_dev_requirements: install_requirements
$(BIN)pip install -r $(DEV_REQUIREMENTS)
# Run unittests and generate html coverage report
test:
coverage run --source=./src -m pytest tests
coverage html
# Run linters check only
lint:
$(BIN)isort . --check
$(BIN)black . --check
# Run linters and try to fix the errors
format:
$(BIN)isort .
$(BIN)black .
# Update all libraries required to run this application
requirements_txt:
sort -u $(BASE_REQUIREMENTS) -o $(BASE_REQUIREMENTS)
pip-compile --output-file=requirements.txt $(BASE_REQUIREMENTS)
requirements_dev_txt:
sort -u $(DEV_REQUIREMENTS) -o $(DEV_REQUIREMENTS)
sort -u $(BASE_REQUIREMENTS) -o $(BASE_REQUIREMENTS)
pip-compile --output-file=requirements-dev.txt $(BASE_REQUIREMENTS) $(DEV_REQUIREMENTS)
# Re/install the virtual environment with all requirements
install: clean venv install_requirements
# Re/install the virtual environment for DEV usage
dev_install: clean venv install_dev_requirements
# Do all checks
build: dev_install lint test