-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (65 loc) · 1.62 KB
/
Makefile
File metadata and controls
78 lines (65 loc) · 1.62 KB
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
PACKAGE := whitespace
TESTS := test
CONFIG_FILE = pyproject.toml
ALL = $(PACKAGE) $(TESTS)
SHELL := bash
POETRY := poetry
RUN := $(POETRY) run
META := .meta
META_INSTALL := $(META)/.install
PYTEST_ARGS ?= -vvl \
--color=yes \
--cov=$(PACKAGE) \
--cov-branch \
--cov-report term-missing \
--cov-report=html:$(META)/html_cov/ \
--cov-report=xml:$(META)/coverage.xml
help:
@echo "build - Build package"
@echo "clean - Delete output files"
@echo "format - Format code with black"
@echo "lint - Lint code with black and pylint"
@echo "lint-black - Lint code with black"
@echo "lint-pylint - Lint code with pylint"
@echo "test - Run unit tests with pytest."
@echo " Use PYTEST_ARGS to override options"
$(META):
mkdir -p $@
$(META_INSTALL): $(CONFIG_FILE) | $(META)
$(POETRY) install
touch $@
.PHONY: build
build:
@echo "** Building package ***"
rm -rf dist
$(POETRY) build
@echo ""
.PHONY: clean
clean:
rm -rf $(PACKAGE)/__pycache__/ \
$(TESTS)/__pycache__/ \
$(META)/ \
.*_cache/ \
dist
rm -f .coverage .coverage.*
.PHONY: format
format: $(META_INSTALL)
$(RUN) black $(ALL)
.PHONY: lint
lint: lint-black lint-pylint
.PHONY: lint-black
lint-black: $(META_INSTALL)
@echo "*** Linting with black ***"
$(RUN) black --check $(ALL)
@echo ""
.PHONY: lint-pylint
lint-pylint: $(META_INSTALL)
@echo "*** Linting with pylint ***"
$(RUN) pylint --rcfile $(CONFIG_FILE) $(PACKAGE)
$(RUN) pylint --rcfile $(TESTS)/$(CONFIG_FILE) $(TESTS)
@echo ""
.PHONY: test
test: $(META_INSTALL)
@echo "*** Running tests ***"
$(RUN) pytest $(PYTEST_ARGS)
@echo ""