-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
56 lines (45 loc) · 1.71 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
SILENT:
.PHONY:
.DEFAULT_GOAL := help
define PRINT_HELP_PYSCRIPT
import re, sys # isort:skip
matches = []
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
matches.append(match.groups())
for target, help in sorted(matches):
print(" %-25s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
help: ## Print this help
@echo
@echo " make targets:"
@echo
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
init-venv: ## Create virtual environment in venv folder
@python3.9 -m venv venv
init: init-venv ## Init virtual environment for development
@./venv/bin/python3 -m pip install -U pip
@./venv/bin/python3 -m pip install -r requirements.txt
@./venv/bin/python3 -m pip install -r requirements.dev.txt
@./venv/bin/python3 -m pre_commit install --install-hooks --overwrite
@./venv/bin/python3 -m pip install -e .
@echo "use 'source venv/bin/activate' to activate venv "
clean-lite: ## Remove pycache files, pytest files, etc
@rm -rf build dist .cache .coverage .coverage.* *.egg-info
@find . -name .coverage | xargs rm -rf
@find . -name .pytest_cache | xargs rm -rf
@find . -name .tox | xargs rm -rf
@find . -name __pycache__ | xargs rm -rf
@find . -name *.egg-info | xargs rm -rf
clean: clean-lite ## Remove virtual environment, downloaded models, etc
@rm -rf venv
@echo "run 'make init'"
format: ## Run formatter on source code
@./venv/bin/python3 -m black --config=pyproject.toml .
lint: ## Run linter on source code
@./venv/bin/python3 -m black --config=pyproject.toml --check .
@./venv/bin/python3 -m flake8 --config=.flake8 .
test: lint ## Run tests
@./venv/bin/pytest -s -vv --cov-config=.coveragerc --cov-report html:htmlcov_v1 --cov-fail-under=50 tests/