2021-09-10 13:46:47 +02:00
|
|
|
.ONESHELL:
|
|
|
|
|
2021-09-13 14:22:20 +02:00
|
|
|
SHELL = bash
|
|
|
|
CPU_CORES = $(shell nproc)
|
2021-09-10 13:46:47 +02:00
|
|
|
|
2021-09-13 14:22:20 +02:00
|
|
|
# PIP_INSTALL = --editable .
|
|
|
|
# PYLINT_ARG =
|
|
|
|
# MYPY_ARG =
|
|
|
|
# PYTEST_ARG =
|
2021-09-10 13:46:47 +02:00
|
|
|
|
2021-09-13 14:22:48 +02:00
|
|
|
SHARED_DEV_REQUIREMENTS = \
|
|
|
|
black \
|
|
|
|
isort \
|
|
|
|
mypy \
|
|
|
|
pylint \
|
|
|
|
pytest \
|
|
|
|
pytest-cov \
|
|
|
|
pytest-xdist
|
|
|
|
|
2021-09-13 14:22:20 +02:00
|
|
|
VENV = venv
|
2021-09-10 13:46:47 +02:00
|
|
|
$(VENV):
|
|
|
|
python3 -m venv $(VENV)
|
2021-09-15 19:40:58 +02:00
|
|
|
source $(VENV)/bin/activate
|
|
|
|
$(MAKE) install
|
|
|
|
|
|
|
|
install: venv
|
2021-09-10 13:46:47 +02:00
|
|
|
source $(VENV)/bin/activate
|
|
|
|
pip install --upgrade pip setuptools wheel
|
2021-09-13 14:22:48 +02:00
|
|
|
pip install $(SHARED_DEV_REQUIREMENTS) $(PIP_INSTALL)
|
2021-09-10 13:46:47 +02:00
|
|
|
|
2021-09-13 14:21:19 +02:00
|
|
|
.PHONY: .format
|
|
|
|
.format: $(VENV)
|
|
|
|
source $(VENV)/bin/activate
|
|
|
|
black .
|
2021-10-17 16:24:37 +02:00
|
|
|
isort . --profile black
|
|
|
|
|
|
|
|
.PHONY: .format-check
|
|
|
|
.format-check: $(VENV)
|
|
|
|
source $(VENV)/bin/activate
|
|
|
|
black . --check
|
|
|
|
isort . --profile black --check
|
2021-09-13 14:21:19 +02:00
|
|
|
|
2021-09-10 13:46:47 +02:00
|
|
|
.PHONY: .pylint
|
|
|
|
.pylint: $(VENV)
|
|
|
|
source $(VENV)/bin/activate
|
|
|
|
pylint --output-format=colorized $(PYLINT_ARG) || true
|
|
|
|
|
2021-09-10 14:41:51 +02:00
|
|
|
.PHONY: .mypy
|
|
|
|
.mypy: $(VENV)
|
|
|
|
source $(VENV)/bin/activate
|
|
|
|
mypy $(MYPY_ARG) || true
|
|
|
|
|
2021-09-10 13:46:47 +02:00
|
|
|
.PHONY: .pytest
|
|
|
|
.pytest: $(VENV)
|
|
|
|
source venv/bin/activate
|
|
|
|
pytest -n $(CPU_CORES) --color=yes -v $(PYTEST_ARG)
|
|
|
|
|
|
|
|
.PHONY: .clean
|
|
|
|
.clean:
|
|
|
|
rm -Rf $(VENV)
|