-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
44 lines (36 loc) · 1.32 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
# Check styling and test notebooks and extra code
NOTEBOOKS=notebooks
PYTEST_ARGS=--cov --cov-report=term-missing --cov -v
LINT_FILES=$(NOTEBOOKS)
BLACK_FILES=$(NOTEBOOKS)
FLAKE8_FILES=$(NOTEBOOKS)
NOTEBOOKS_LIST = $(wildcard $(NOTEBOOKS)/*.ipynb)
NBCONVERT = jupyter nbconvert --inplace --to notebook
NBCONVERT_ARGS = --ExecutePreprocessor.kernel_name=python3
help:
@echo "Commands:"
@echo ""
@echo " run run every notebook on the repository"
@echo " test run the test suite and report coverage"
@echo " format run black to automatically format the code"
@echo " check run code style and quality checks (black and flake8)"
@echo " lint run pylint for a deeper (and slower) quality check"
@echo " clean clean up build and generated files"
@echo ""
run:
$(foreach notebook, $(NOTEBOOKS_LIST), $(NBCONVERT) $(NBCONVERT_ARGS) --execute $(notebook);)
test:
# Run a tmp folder to make sure the tests are run on the installed version
MPLBACKEND='agg' pytest $(PYTEST_ARGS) $(NOTEBOOKS)
format:
black $(BLACK_FILES)
check:
black --check $(BLACK_FILES)
flake8 $(FLAKE8_FILES)
lint:
pylint --jobs=0 $(LINT_FILES)
clean:
find . -name "*.pyc" -exec rm -v {} \;
find . -name ".coverage.*" -exec rm -v {} \;
rm -rvf build dist *.egg-info __pycache__ .coverage .cache .pytest_cache
rm -rvf dask-worker-space