forked from aramis-lab/clinica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
115 lines (90 loc) · 2.13 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
PACKAGES := clinica test
POETRY ?= poetry
CONDA ?= conda
CONDA_ENV ?= "./env"
.PHONY: help
help: Makefile
@echo "Commands:"
@sed -n 's/^##//p' $<
.PHONY: check.lock
check.lock:
@$(POETRY) lock --check
# clean : Clean project tree.
.PHONY: clean
clean: clean.doc clean.py clean.test
.PHONY: clean.doc
clean.doc:
@$(RM) -rf site/
.PHONY: clean.py
clean.py:
@find . -name __pycache__ -exec $(RM) -r {} +
.PHONY: clean.test
clean.test:
@$(RM) -r .pytest_cache/
.PHONY: config.pypi
config.pypi:
ifdef PYPI_TOKEN
@$(POETRY) config pypi-token.pypi "${PYPI_TOKEN}"
else
$(error "Missing API token for PyPI repository")
endif
## doc : Build the documentation.
.PHONY: doc
doc: clean.doc install.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: install
## format : Format the codebase.
.PHONY: format
format: install.dev format.black format.isort
.PHONY: format.black
format.black:
$(info Formatting code with black)
@$(POETRY) run black --quiet $(PACKAGES)
.PHONY: format.isort
format.isort:
$(info Formatting code with isort)
@$(POETRY) run isort --quiet $(PACKAGES)
## install : Install the project.
.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
## lint : Lint the codebase.
.PHONY: lint
lint: install.dev lint.black lint.isort
.PHONY: lint.black
lint.black:
$(info Linting code with black)
@$(POETRY) run black --check --diff $(PACKAGES)
.PHONY: lint.isort
lint.isort:
$(info Linting code with isort)
@$(POETRY) run isort --check --diff $(PACKAGES)
## lock : Refresh locked dependencies.
.PHONY: lock
lock:
@$(POETRY) lock --no-update
## publish : Publish the package to PyPI.
.PHONY: publish
publish: publish.pypi
.PHONY: publish.pypi
publish.pypi: config.pypi
@$(POETRY) publish --build
.PHONY: spellcheck
spellcheck: install.dev
@$(POETRY) run codespell
.PHONY: test
test: install
@$(POETRY) run python -m pytest -v test/unittests