generated from BastiTee/python-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (60 loc) · 1.67 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
ifeq (, $(shell which python))
$(error "No python on PATH.")
endif
POETRY_CMD := python -m poetry
ifeq (, $(shell $(POETRY_CMD)))
$(error "Poetry not available in Python installation.")
endif
export LC_ALL = C
export LANG = C.UTF-8
PY_FILES := tolino_notes tests
VERSION := $(shell poetry version --short)
all: clean venv build
@echo Executed default build pipeline
clean:
@echo Clean project base
find . -type d \
-name ".venv" -o \
-name ".tox" -o \
-name ".ropeproject" -o \
-name ".mypy_cache" -o \
-name ".pytest_cache" -o \
-name "__pycache__" -o \
-iname "*.egg-info" -o \
-name "build" -o \
-name "dist" \
|xargs rm -rfv
clear-cache:
@echo Clear poetry cache
$(POETRY_CMD) cache clear pypi --all --no-interaction
venv: clean
@echo Initialize virtualenv, i.e., install required packages etc.
$(POETRY_CMD) config virtualenvs.in-project true --local
$(POETRY_CMD) install
shell:
@echo Open a new shell using virtualenv
$(POETRY_CMD) shell
build: test mypy isort black lint
@echo Run build process to package application
$(POETRY_CMD) build
test:
@echo Run all tests suites
$(POETRY_CMD) run py.test tests
mypy:
@echo Run static code checks against source code base
$(POETRY_CMD) run mypy $(PY_FILES)
isort:
@echo Check for incorrectly sorted imports
$(POETRY_CMD) run isort --check-only $(PY_FILES)
isort-apply:
@echo Check and correct incorrectly sorted imports
$(POETRY_CMD) run isort $(PY_FILES)
black:
@echo Run code formatting using black
$(POETRY_CMD) run black $(PY_FILES)
lint:
@echo Run code formatting checks against source code base
$(POETRY_CMD) run flake8 $(PY_FILES)
outdated:
@echo Show outdated dependencies
$(POETRY_CMD) show --outdated