-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (52 loc) · 1.21 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
75
76
77
78
79
80
81
82
83
84
.SHELL := /bin/bash
name := $(shell pdm show --name)
version := $(shell pdm show --version)
sdist := dist/$(name)-$(version).tar.gz
wheel := dist/$(subst -,_,$(name))-$(version)-py3-none-any.whl
src := $(shell find src -type f -print)
tests := $(shell find tests -type f -print)
python_src := $(filter %.py, $(src) $(tests))
PYTHONDONTWRITEBYTECODE=1
export PYTHONDONTWRITEBYTECODE
.coverage: $(src) $(tests)
pdm run coverage run -m tests
test: .coverage
.PHONY: test
coverage-report: .coverage
coverage html
python -m webbrowser -t file://$(CURDIR)/htmlcov/index.html
build: $(sdist) $(wheel)
wheel: $(wheel)
.PHONY: wheel
sdist: $(sdist)
.PHONY: sdist
$(sdist): $(src)
pdm build --no-wheel
$(wheel): $(src)
pdm build --no-sdist
clean: clean-build clean-venv
rm -rf .coverage .fmt htmlcov .mypy_cache node_modules
.PHONY: clean
clean-build:
rm -rf dist build
.PHONY: clean-build
clean-venv:
rm -rf .venv
.PHONY: clean-venv
pylint:
pylint src tests
.PHONY: pylint
mypy:
mypy
.PHONY: mypy
lint: pylint mypy
.PHONY: lint
fmt: .fmt
.PHONY: fmt
.fmt: $(python_src)
pdm run python -m isort --line-width=88 $?
pdm run python -m black $?
touch $@
update:
pdm update --update-eager
.PHONY: update