-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile
61 lines (49 loc) · 2.02 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
# Build, package, test, and clean
PROJECT=harmonica
TESTDIR=tmp-test-dir-with-unique-name
PYTEST_ARGS=--cov-config=../.coveragerc --cov-report=term-missing --cov=$(PROJECT) --doctest-modules --doctest-continue-on-failure -v --pyargs
NUMBATEST_ARGS=--doctest-modules -v --pyargs -m use_numba
STYLE_CHECK_FILES=$(PROJECT) examples doc
help:
@echo "Commands:"
@echo ""
@echo " install install in editable mode"
@echo " test run the test suite (including doctests) and report coverage"
@echo " format run isort and black to automatically format the code"
@echo " check run code style and quality checks (black, isort and flake8)"
@echo " build build source and wheel distributions"
@echo " clean clean up build and generated files"
@echo ""
.PHONY: build, install, test, test_coverage, test_numba, format, check, black, black-check, isort, isort-check, license, license-check, flake8, clean
build:
python -m build .
install:
python -m pip install --no-deps -e .
test: test_coverage test_numba
test_coverage:
# Run a tmp folder to make sure the tests are run on the installed version
mkdir -p $(TESTDIR)
cd $(TESTDIR); NUMBA_DISABLE_JIT=1 MPLBACKEND='agg' pytest $(PYTEST_ARGS) $(PROJECT)
cp $(TESTDIR)/.coverage* .
rm -rvf $(TESTDIR)
test_numba:
# Run a tmp folder to make sure the tests are run on the installed version
mkdir -p $(TESTDIR)
cd $(TESTDIR); NUMBA_DISABLE_JIT=0 MPLBACKEND='agg' pytest $(NUMBATEST_ARGS) $(PROJECT)
rm -rvf $(TESTDIR)
format:
isort $(STYLE_CHECK_FILES)
black $(STYLE_CHECK_FILES)
burocrata --extension=py $(STYLE_CHECK_FILES)
check: check-format check-style
check-format:
isort --check $(STYLE_CHECK_FILES)
black --check $(STYLE_CHECK_FILES)
burocrata --check --extension=py $(STYLE_CHECK_FILES)
check-style:
flake8 $(STYLE_CHECK_FILES)
clean:
find . -name "*.pyc" -exec rm -v {} \;
find . -name ".coverage.*" -exec rm -v {} \;
rm -rvf build dist MANIFEST *.egg-info __pycache__ .coverage .cache .pytest_cache $(PROJECT)/_version.py
rm -rvf $(TESTDIR) dask-worker-space