-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathmakefile
98 lines (82 loc) · 2.21 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
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
.PHONY: help
.PHONY: black black-check flake8
.PHONY: test
.PHONY: conda-env
.PHONY: black isort format
.PHONY: black-check isort-check format-check, code-standard-check
.PHONY: flake8
.PHONY: pydocstyle-check
.PHONY: darglint-check
.PHONY: build-docs
.PHONY: clean-all
.DEFAULT: help
help:
@echo "test"
@echo " Run pytest on the project and report coverage"
@echo "black"
@echo " Run black on the project"
@echo "black-check"
@echo " Check if black would change files"
@echo "flake8"
@echo " Run flake8 on the project"
@echo "pydocstyle-check"
@echo " Run pydocstyle on the project"
@echo "darglint-check"
@echo " Run darglint on the project"
@echo "code-standard-check"
@echo " Run all linters on the project to check quality standards."
@echo "conda-env"
@echo " Create conda environment 'cockpit' with dev setup"
@echo "build-docs"
@echo " Build the docs"
@echo "clean-all"
@echo " Removes all unnecessary files."
### TESTING ###
# Run pytest with the Matplotlib backend agg to not show plots
test:
@MPLBACKEND=agg pytest -vx --cov=cockpit .
### LINTING & FORMATTING ###
# Uses black.toml config instead of pyproject.toml to avoid pip issues. See
# - https://github.com/psf/black/issues/683
# - https://github.com/pypa/pip/pull/6370
# - https://pip.pypa.io/en/stable/reference/pip/#pep-517-and-518-support
black:
@black . --config=black.toml
black-check:
@black . --config=black.toml --check
flake8:
@flake8 .
pydocstyle-check:
@pydocstyle --count .
darglint-check:
@darglint --verbosity 2 .
isort:
@isort .
isort-check:
@isort . --check
format:
@make black
@make isort
@make black-check
format-check: black-check isort-check pydocstyle-check darglint-check
code-standard-check:
@make black
@make isort
@make black-check
@make flake8
@make pydocstyle-check
### CONDA ###
conda-env:
@conda env create --file .conda_env.yml
### DOCS ###
build-docs:
@find . -type d -name "automod" -exec rm -r {} +
@cd docs && make clean && make html
### CLEAN ###
clean-all:
@find . -name '*.pyc' -delete
@find . -name '*.pyo' -delete
@find . -name '*~' -delete
@find . -type d -name "__pycache__" -delete
@rm -fr .pytest_cache/
@rm -fr .benchmarks/