-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (55 loc) · 1.89 KB
/
Makefile
File metadata and controls
69 lines (55 loc) · 1.89 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
.FORCE:
BLUE=\033[0;34m
BLACK=\033[0;30m
help:
@echo "$(BLUE) make test - run all unit tests"
@echo " make test-log - run all unit tests and write log to pytest.log"
@echo " make test-nb - run nbmake tests on RVC3 vision chapter notebooks"
@echo " make coverage - run unit tests and coverage report"
@echo " make typehints - run mypy type-hint coverage report and open HTML"
@echo " make docs - build Sphinx documentation"
@echo " make view - open Sphinx doco build (uses open for MacOS)"
@echo " make dist - preview dist build"
@echo " make pypi - build the dist, upload to PyPI, tag the release and push the tag to origin"
@echo " make clean - remove dist and docs build files"
@echo " make help - this message$(BLACK)"
test:
validate-pyproject pyproject.toml
python -m pytest
test-log:
python -m pytest -W all --tb=short 2>&1 | tee pytest.log
@echo "pytest log --> pytest.log"
test-nb:
python -m pytest --nbmake notebooks
test-rvc:
MVTB_TEST_MODE=True python -m pytest --nbmake tests/RVC
coverage:
coverage run --source='src/machinevisiontoolbox' -m pytest
coverage report
coverage html
open -a Safari htmlcov/index.html
typehints:
-mypy src/machinevisiontoolbox --ignore-missing-imports --html-report /tmp/mypy-typehints
open -a Safari /tmp/mypy-typehints/index.html
docs: .FORCE
(cd docs; make html O="-w warnings.txt")
view: .FORCE
open -a Safari docs/build/html/index.html
dist: .FORCE
# $(MAKE) test
python -m build
ls -lh dist/*
pypi: .FORCE
@if ! git diff --quiet || ! git diff --cached --quiet; then \
echo "Error: uncommitted changes present, aborting upload"; exit 1; \
fi
python -m build
$(eval VERSION := $(shell grep '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/'))
@echo "Uploading version $(VERSION) to PyPI"
twine upload dist/*
git tag v$(VERSION)
git push origin v$(VERSION)
clean: .FORCE
(cd docs; make clean)
-rm -r *.egg-info
-rm -r dist build