-
Notifications
You must be signed in to change notification settings - Fork 38
/
Makefile
103 lines (64 loc) · 2.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
VENV=.venv
REPORTS=.reports
BENCHMARK=benchmark
SOURCES=rectools
TESTS=tests
SCRIPTS=scripts
# Installation
.reports:
mkdir ${REPORTS}
.venv:
poetry install -E all --no-root
install: .venv .reports
# Linters
.isort:
poetry run isort --check ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.black:
poetry run black --check --diff ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.pylint:
poetry run pylint --jobs 4 ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.mypy:
poetry run mypy ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.flake8:
poetry run flake8 ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.bandit:
poetry run bandit -q -c bandit.yml -r ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.codespell:
poetry run codespell ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
# Fixers & formatters
.isort_fix:
poetry run isort ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.autopep8_fix:
poetry run autopep8 --in-place -r ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
.black_fix:
poetry run black -q ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
# Tests
.pytest:
poetry run pytest ${TESTS} --cov=${SOURCES} --cov-report=xml
.doctest:
poetry run pytest --doctest-modules ${SOURCES} --ignore=rectools/models/lightfm.py
coverage: .venv .reports
poetry run coverage run --source ${SOURCES} --module pytest
poetry run coverage report
poetry run coverage html -d ${REPORTS}/coverage_html
poetry run coverage xml -o ${REPORTS}/coverage.xml -i
# Generalization
.format: .isort_fix .autopep8_fix .black_fix
format: .venv .format
.lint: .isort .black .flake8 .codespell .mypy .pylint .bandit
lint: .venv .lint
.test: .pytest .doctest
test: .venv .test
# Copyright
copyright:
poetry run python -m scripts.copyright --check ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
copyright_fix:
poetry run python -m scripts.copyright ${SOURCES} ${TESTS} ${SCRIPTS} ${BENCHMARK}
# Cleaning
clean:
rm -rf build dist .eggs *.egg-info
rm -rf ${VENV}
rm -rf ${REPORTS}
find . -type d -name '.mypy_cache' -exec rm -rf {} +
find . -type d -name '*pytest_cache*' -exec rm -rf {} +
reinstall: clean install