-
Notifications
You must be signed in to change notification settings - Fork 53
/
Makefile
89 lines (69 loc) · 1.53 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
PACKAGES := clinicadl tests
POETRY ?= poetry
CONDA ?= conda
CONDA_ENV ?= "./env"
.PHONY: help
help: Makefile
@echo "Commands:"
@sed -n 's/^##//p' $<
.PHONY: check.lock
check.lock:
@$(POETRY) check --lock
## build : Build the package.
.PHONY: build
build:
@$(POETRY) build
.PHONY: clean.doc
clean.doc:
@$(RM) -rf site
.PHONY: clean.test
clean.test:
@$(RM) -r .pytest_cache/
## doc : Build the documentation.
.PHONY: doc
doc: clean.doc env.doc
@$(POETRY) run mkdocs build
## env : Bootstrap an environment.
.PHONY: env
env: env.dev
.PHONY: env.conda
env.conda:
@$(CONDA) env create -p $(CONDA_ENV)
.PHONY: env.dev
env.dev:
@$(POETRY) install
.PHONY: env.doc
env.doc:
@$(POETRY) install --extras docs
## format : Format the codebase.
.PHONY: format
format: format.black format.isort
.PHONY: format.black
format.black: env.dev
@$(POETRY) run black --quiet $(PACKAGES)
.PHONY: format.isort
format.isort: env.dev
@$(POETRY) run isort --quiet $(PACKAGES)
## lint : Lint the codebase.
.PHONY: lint
lint: lint.black lint.isort
.PHONY: lint.black
lint.black: env.dev
@$(POETRY) run black --check --diff $(PACKAGES)
.PHONY: lint.isort
lint.isort: env.dev
@$(POETRY) run isort --check --diff $(PACKAGES)
## Install
.PHONY: install
install: check.lock
@$(POETRY) install
.PHONY: install.dev
install.dev: check.lock
@$(POETRY) install --only dev
.PHONY: install.doc
install.doc: check.lock
@$(POETRY) install --only docs
## tests : Run the unit tests
.PHONY: test
test: install
@$(POETRY) run python -m pytest -v tests/unittests