-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 2.25 KB
/
Makefile
File metadata and controls
88 lines (68 loc) · 2.25 KB
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
# Usage:
# make clean # remove ALL binaries and objects
# make changelog
# make check
# make cov
# make lint
# make watch-check
VENV = poetry run
PYTEST = $(VENV) python -m pytest --tb=short tests/ --report-log=.pytest_cache/pytest.json
.PHONY: all
all:
@echo "No action taken"
.PHONY: clean
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test: ## remove test and coverage artifacts
rm -fr .coverage
rm -fr .pytest_cache
.PHONY: changelog
changelog:
$(VENV) python3 example.py
.PHONY: check
check:
$(PYTEST)
.PHONY: coverage
coverage:
$(PYTEST) --cov-report term-missing --cov=whathappened/
.PHONY: watch-check
watch-check:
$(VENV) ptw --runner="$(PYTEST)" \
--onpass "notify-send -i emblem-default Pytest \"All Tests Pass!\"" \
--onfail "python3 tests/misc/pytest-summary.py .pytest_cache/pytest.json \
| xargs -r -i notify-send -i error Pytest \"{}\""
.PHONY: black
black:
$(VENV) black -S *.py tests/*.py whathappened/*.py
.PHONY: lint
lint:
## stop the build if there are Python syntax errors or undefined names
$(VENV) flake8 . --extend-exclude=.venv/,.github/ --count --select=E9,F63,F7,F82 --show-source --statistics
## exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
$(VENV) flake8 . --extend-exclude=.venv/,.github/,build/,dist/,version/,versioneer.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
.PHONY: install
install:
poetry install
.PHONY: install-production
install-production:
poetry install --no-dev
.PHONY: uninstall
uninstall: ## remove virtual environment
rm -rf .venv/
test-release: dist ## package and upload a release to the test PyPI
python3 -m twine upload -r pypitest dist/*
release: dist ## package and upload a release
python3 -m twine upload dist/*
dist: clean ## builds source and wheel package
python3 setup.py sdist bdist_wheel
ls -l dist