forked from nih-sparc/sparc.client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (59 loc) · 1.9 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
# defaults
.DEFAULT_GOAL := help
# Use bash not sh
SHELL := /bin/bash
.PHONY: help
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@echo "usage: make [target] ..."
@echo ""
@echo "Targets for '$(notdir $(CURDIR))':"
@echo ""
@awk --posix 'BEGIN {FS = ":.*?## "} /^[[:alpha:][:space:]_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@echo ""
.venv:
@python3 --version
python3 -m venv $@
## upgrading tools to latest version in $(shell python3 --version)
$@/bin/pip3 --quiet install --upgrade \
pip~=23.1 \
wheel \
setuptools
@$@/bin/pip3 list --verbose
.PHONY: devenv
devenv: .venv ## create a development environment (configs, virtual-env, hooks, ...)
@.venv/bin/pip install --upgrade pre-commit
# Installing pre-commit hooks in current .git repo
@.venv/bin/pre-commit install
@echo "To activate the venv, execute 'source .venv/bin/activate'"
.PHONY: install-dev
install-dev: ## installs package in editable mode
pip install --editable '.[test]'
.PHONY: test-dev
test-dev: ## runs tests
pytest \
--cov=./src \
-vv \
--pdb \
--cov-append \
--cov-report=term-missing \
--cov-report=xml \
tests/
.PHONY: clean clean-venv clean-hooks
_git_clean_args := -dx --force \
--exclude=.vscode \
--exclude=.venv \
--exclude=.python-version \
--exclude="*keep*"
.check-clean:
@git clean -n $(_git_clean_args)
@echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]
@echo -n "$(shell whoami), are you REALLY sure? [y/N] " && read ans && [ $${ans:-N} = y ]
clean-venv: ## Removes .venv into original configuration
# Cleaning your venv
-rm -rf .venv
clean-hooks: ## Uninstalls git pre-commit hooks
@-pre-commit uninstall 2> /dev/null || rm .git/hooks/pre-commit
clean: .check-clean ## cleans all unversioned files in project and temp files create by this makefile
# Cleaning unversioned
@git clean $(_git_clean_args)