-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (93 loc) · 3.06 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
.DEFAULT_GOAL := all
package = turvallisuusneuvonta
pyversion = py312
linelength = 120
black = black -S -l $(linelength) --target-version $(pyversion) $(package) test
lint = ruff check $(package) test
pytest = pytest --asyncio-mode=strict --cov=$(package) --cov-report term-missing:skip-covered --cov-branch --log-format="%(levelname)s %(message)s"
types = mypy $(package)
.PHONY: install
install:
pip install -U pip wheel
pip install -r test/requirements.txt
pip install -e . --config-settings editable_mode=strict
.PHONY: install-all
install-all: install
pip install -r test/requirements-dev.txt
.PHONY: format
format:
$(lint) --fix
$(black)
.PHONY: init
init:
pip install -r test/requirements.txt
pip install -r test/requirements-dev.txt
.PHONY: lint
lint:
validate-pyproject pyproject.toml
$(lint) --diff
$(black) --check --diff
.PHONY: types
types:
$(types)
.PHONY: test
test: clean
$(pytest)
.PHONY: testcov
testcov: test
@echo "building coverage html"
@coverage html
.PHONY: all
all: lint types testcov
.PHONY: sbom
sbom:
@bin/gen-sbom
@cog -I. -P -c -r --check --markers="[[fill ]]] [[[end]]]" -p "from bin.gen_sbom import *;from bin.gen_licenses import *" docs/third-party/README.md
.PHONY: version
version:
@cog -I. -P -c -r --check --markers="[[fill ]]] [[[end]]]" -p "from bin.gen_version import *" $(package)/__init__.py
.PHONY: secure
secure:
@bandit --output etc/current-bandit.json --baseline etc/baseline-bandit.json --format json --recursive --quiet --exclude ./test,./build $(package)
@diff -Nu etc/{baseline,current}-bandit.json; printf "^ Only the timestamps ^^ ^^ ^^ ^^ ^^ ^^ should differ. OK?\n"
.PHONY: baseline
baseline:
@bandit --output etc/baseline-bandit.json --format json --recursive --quiet --exclude ./test,./build $(package)
@cat etc/baseline-bandit.json; printf "\n^ The new baseline ^^ ^^ ^^ ^^ ^^ ^^. OK?\n"
.PHONY: clocal
clocal:
@rm -rf .benchmarks .hypothesis .*_cache
.PHONY: clean
clean: clocal
@rm -rf `find . -name __pycache__`
@rm -f `find . -type f -name '*.py[co]' `
@rm -f `find . -type f -name '*~' `
@rm -f `find . -type f -name '.*~' `
@rm -rf .cache htmlcov *.egg-info build dist/*
@rm -f .coverage .coverage.* *.log .DS_Store
@echo skipping not yet working pip uninstall $(package)
@rm -fr site/*
.PHONY: name
name:
@printf "Release '%s'\n\n" "$$(git-release-name "$$(git rev-parse HEAD)")"
@printf "%s revision.is(): sha1:%s\n" "-" "$$(git rev-parse HEAD)"
@printf "%s name.derive(): '%s'\n" "-" "$$(git-release-name "$$(git rev-parse HEAD)")"
@printf "%s node.id(): '%s'\n" "-" "$$(bin/gen_node_identifier.py)"
.PHONY: dlstats
dlstats:
@pypistats python_minor --json --monthly $(package) > etc/monthly-downloads.json
@rq '$$.data..*.downloads' etc/monthly-downloads.json | paste -sd+ - | bc
@jq . etc/monthly-downloads.json > etc/tempaway && mv etc/tempaway etc/monthly-downloads.json
@bin/downloads-per-month
.PHONY: gitstats
gitstats:
@bin/git-stats
@bin/commits-per-year
.PHONY: pypistats
pypistats:
@bin/packaging-facts
@bin/python-versions
@bin/latest-release
.PHONY: covstats
covstats:
bin/gen-coverage