generated from NicolaiRuckel/python-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (52 loc) · 1.35 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
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
SOURCE_FOLDERS = src tests
MODULE_NAME = sample_package
SOURCES = $(shell find $(SOURCE_FOLDERS) -type f -name '*.py')
DOCS= $(shell find docs -type f -name '*.rst') docs/conf.py
VENV=.venv
.PHONY: install
install: $(VENV) poetry.lock
poetry.lock: pyproject.toml
poetry install
$(VENV): poetry.lock $(SOURCES)
if [ -d $(VENV) ]; then poetry update; fi
poetry install
touch $(VENV)
.PHONY: codeformat
codeformat: $(SOURCES)
poetry run black src
.PHONY: test
test:
poetry run pytest --cov-append --cov-report=html --cov=src tests
.PHONY: linter
linter: poetry.lock
poetry run black --check src
poetry run pydocstyle $(SOURCE_FOLDERS)
poetry run flake8 $(SOURCE_FOLDERS)
poetry run pylint --score=no --extension-pkg-whitelist=lxml,dockerfile src
.PHONY: docs
docs: $(DOCS) install
poetry run sphinx-apidoc --force -o docs/api-docs/ src
poetry run make html -C docs
rm -rf docs/api-docs
.PHONY: docs-spelling
docs-spelling:
mkdir -p docs/_static
poetry run make spelling -C docs
.PHONY: distribution
distribution: test
poetry build
.PHONY: clean
clean:
rm -rf poetry.lock
rm -rf .venv
rm -rf .pytest-cache
rm -rf src/$(MODULE_NAME).egg-info
rm -rf dist/
make clean -C docs
rm -rf docs/api-docs/*