-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (55 loc) · 2.29 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
ifdef OS
PYTHON ?= .venv/Scripts/python.exe
TYPE_CHECK_COMMAND ?= echo Pytype package doesn't support Windows OS
else
PYTHON ?= .venv/bin/python
TYPE_CHECK_COMMAND ?= ${PYTHON} -m pytype --config=pytype.cfg src
endif
SETTINGS_FILENAME = pyproject.toml
PHONY = help install install-dev build format lint type-check secure test install-flit enable-pre-commit-hooks run
help:
@echo "--------------- HELP ---------------"
@echo "To install the project -> make install"
@echo "To install the project using symlinks (for development) -> make install-dev"
@echo "To build the wheel package -> make build"
@echo "To test the project -> make test"
@echo "To test with coverage [all tests] -> make test-cov"
@echo "To format code -> make format"
@echo "To check linter -> make lint"
@echo "To run type checker -> make type-check"
@echo "To run all security related commands -> make secure"
@echo "------------------------------------"
install:
${PYTHON} -m flit install --env --deps=production
install-dev:
${PYTHON} -m flit install -s --env --deps=develop --symlink
install-flit:
${PYTHON} -m pip install flit==3.8.0
enable-pre-commit-hooks:
${PYTHON} -m pre_commit install
build:
${PYTHON} -m flit build --format wheel
${PYTHON} -m pip install dist/*.whl
${PYTHON} -c 'import pytemplate; print(pytemplate.__version__)'
format:
${PYTHON} -m isort src tests --force-single-line-imports --settings-file ${SETTINGS_FILENAME}
${PYTHON} -m autoflake --remove-all-unused-imports --recursive --remove-unused-variables --in-place src --exclude=__init__.py
${PYTHON} -m black src tests --config ${SETTINGS_FILENAME}
${PYTHON} -m isort src tests --settings-file ${SETTINGS_FILENAME}
lint:
${PYTHON} -m flake8 --toml-config ${SETTINGS_FILENAME} --max-complexity 5 --max-cognitive-complexity=5 src
${PYTHON} -m black src tests --check --diff --config ${SETTINGS_FILENAME}
${PYTHON} -m isort src tests --check --diff --settings-file ${SETTINGS_FILENAME}
type-check:
@$(TYPE_CHECK_COMMAND)
secure:
${PYTHON} -m bandit -r src --config ${SETTINGS_FILENAME}
${PYTHON} -m safety check
test:
${PYTHON} -m pytest -svvv -m "not slow and not integration" tests
test-slow:
${PYTHON} -m pytest -svvv -m "slow" tests
test-integration:
${PYTHON} -m pytest -svvv -m "integration" tests
run:
${PYTHON} -m src.pytemplate.main