-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
118 lines (95 loc) · 3.63 KB
/
Copy pathMakefile
File metadata and controls
118 lines (95 loc) · 3.63 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/make -f
PYTHON=python3
SPHINX_APIDOC=sphinx-apidoc
TARGET=epr
CYTHON=$(PYTHON) -m cython
CYTHONFLAGS=-3
TEST_DATSET = tests/$(shell grep N1 tests/test_all.py | cut -d '"' -f 2)
EPRAPIROOT = extern/epr-api
.PHONY: default help dist check fullcheck coverage clean cleaner distclean \
lint docs ext wheels \
debug cythonize ext-coverage coverage-report
default: help
help:
@echo "Usage: make <TARGET>"
@echo "Available targets:"
@echo " help - print this help message"
@echo " dist - generate the distribution packages (source and wheel)"
@echo " check - run a full test (using pytest)"
@echo " fullcheck - run a full test (using tox)"
@echo " coverage - run tests and generate the coverage report"
@echo " clean - clean build artifacts"
@echo " cleaner - clean cache files and working directories of al tools"
@echo " distclean - clean all the generated files"
@echo " lint - perform check with code linter (flake8, black)"
@echo " docs - generate the sphinx documentation"
@echo " ext - build Python extensions in-place"
@echo " wheels - build Python wheels"
@echo " cythonize - generate cython C extensions"
@echo " debug - generate debug build"
@echo " ext-coverage - build the extension in-place with tracing enabled"
@echo " coverage-report - generate the coverage report"
@echo " stubs - generate Python typing stubs for cython modules"
dist:
$(PYTHON) -m build
$(PYTHON) -m twine check dist/*.tar.gz dist/*.whl
check: ext
env PYTHONPATH=src $(PYTHON) -m pytest --doctest-modules src/$(TARGET) tests
fullcheck:
$(PYTHON) -m tox run
coverage: clean ext-coverage
env PYTHONPATH=src $(PYTHON) -m pytest --doctest-modules --cov=$(TARGET) --cov-report=html --cov-report=term src/$(TARGET) tests
clean:
# $(PYTHON) setup.py clean --all
$(RM) -r src/*.*-info build
find . -name __pycache__ -type d -exec $(RM) -r {} +
# $(RM) -r __pycache__ */__pycache__ */*/__pycache__ */*/*/__pycache__
$(RM) src/$(TARGET)/*.c src/$(TARGET)/*.cpp src/$(TARGET)/*.so src/$(TARGET)/*.o
# if [ -f docs/Makefile ] ; then $(MAKE) -C docs clean; fi
$(RM) -r docs/_build
$(RM) MANIFEST
find . -name '*~' -delete
$(RM) src/epr/epr.html
$(RM) epr.p* # workaround for Cython.Coverage bug #1985
cleaner: clean
$(RM) -r .coverage htmlcov
$(RM) -r .pytest_cache
$(RM) -r .tox
$(RM) -r .mypy_cache
$(RM) -r .ruff_cache
$(RM) -r .ipynb_checkpoints
$(RM) -r .hypothesis
distclean: cleaner
$(RM) -r dist
$(RM) -r wheelhouse
$(RM) $(TEST_DATSET)
lint:
# $(PYTHON) -m flake8 --count --statistics src/$(TARGET) tests
$(PYTHON) -m pydocstyle --count src/$(TARGET)
# $(PYTHON) -m isort --check src/$(TARGET) tests
$(PYTHON) -m black --check src/$(TARGET) tests
$(PYTHON) -m mypy --check-untyped-defs src/$(TARGET) # --ignore-missing-imports
# ruff check src/$(TARGET) tests
codespell
docs:
mkdir -p docs/_static
$(MAKE) -C docs html
$(MAKE) -C docs linkcheck
$(MAKE) -C docs spelling
ext: src/epr/_epr.pyx src/epr/_epr.pxd
$(PYTHON) setup.py build_ext --inplace --epr-api-src=$(EPRAPIROOT)/src
cythonize: src/epr/_epr.c
src/epr/_epr.c: src/epr/_epr.pyx src/epr/_epr.pxd
$(CYTHON) $(CYTHONFLAGS) -o src/epr/_epr.c src/epr/_epr.pyx
ext-coverage: src/epr/_epr.pyx src/epr/_epr.pxd
env PYEPR_COVERAGE=TRUE $(PYTHON) setup.py build_ext --inplace
debug:
$(PYTHON)d setup.py build_ext --inplace --debug
wheels:
# Requires docker
python3 -m cibuildwheel --platform auto
stubs:
env PYTHONPATH=src stubgen -v -m epr._epr -o src
mv src/epr/_epr.pyi _epr.pyi
grep -v _cython _epr.pyi | grep -v __pyx_ | grep -v _typeshed | grep -v Incomplete > src/epr/_epr.pyi
$(RM) _epr.pyi