-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·90 lines (73 loc) · 2.42 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
SHELL=bash -o pipefail # Just in case
PYFILES=$(shell find unit_tests src -iname \*.py ; echo *.py)
STRICT_TYPED_FILES=$(shell find src -iname \*.py)
VERSION=src/powerflex_logging_utilities/VERSION
all: commitready
commitready: format-fix lint type-check-strict test-readme test-unit
setup-with-pipenv:
python -m pip install --upgrade pip
pip install pipenv
# Avoid stale dependencies by removing the existing Pipfile
rm -f Pipfile
# Avoid using the Pipfile from a higher level directory
touch Pipfile
pipenv install --skip-lock \
-e .[nats-and-pydantic2] \
-r requirements_dev.txt \
--python $(shell grep python .tool-versions | cut -d' ' -f2)
setup-cicd:
python -m pip install --upgrade pip
pip install -e .[nats-and-pydantic2] -r requirements_dev.txt
bump-version:
git commit -m 'Bump version to $(shell cat $(VERSION))' $(VERSION)
release:
git log -1 | grep 'Bump version' || \
(echo Please make sure the last commit is only changing the VERSION file ; exit 1)
python -m pip install --upgrade pip twine
rm -rf dist
python -m build
twine upload dist/*
git tag -a v$(shell cat $(VERSION)) -m "v$(shell cat $(VERSION)) (released to pypi)"
git push --tags
test-readme:
phmdoctest README.md --outfile _generated_test_readme.py
pytest _generated_test_readme.py
test-unit:
# Pass -k to pytest to filter by test name or filename
# Pass -s to pytest to show stdout
# Add --show-capture=no to hide captured output on failure
pytest \
-v \
--log-format="%(levelname)s %(asctime)s %(filename)s:%(module)s:%(funcName)s:%(lineno)s %(message)s" \
--cov-report term --cov-report html --cov=src/powerflex_logging_utilities \
--durations=0 --durations-min=0.005 \
unit_tests
test-unit-all-python-versions:
tox
tox-recreate:
tox --recreate
lint:
pydocstyle --add-ignore=D100,D101,D102,D103,D104,D105,D106,D107,D202,D412 src unit_tests
pylint src unit_tests
type-check-strict:
mypy --no-warn-unused-ignores --strict $(STRICT_TYPED_FILES)
format-fix:
black ${PYFILES}
isort ${PYFILES}
format-check:
black --check ${PYFILES}
isort --check ${PYFILES}
repl:
ipython -i repl.py
clean:
rm -rf logs/
# Python files
rm -rf .pytest_cache reqlib-metadata __pycache__ .mypy_cache htmlcov .coverage
rm -rf src/.pytest_cache src/powerflex_logging_utilities.egg-info/
rm -rf build/
rm -rf dist/
rm -rf _generated_test_readme.py
# Remove __pycache__ directories
rm -rf $(shell find . -type d -iname __pycache__)
clean-all:
rm -rf .tox