-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
54 lines (45 loc) · 1.42 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
.DEFAULT_GOAL := help
VENV := $(shell echo $${VIRTUAL_ENV-.venv})
PYTHON = $(VENV)/bin/python
INSTALL_STAMP = $(VENV)/.install.stamp
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
.PHONY: help
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
install: $(INSTALL_STAMP) ## install the package to the active Python's site-packages
$(INSTALL_STAMP): $(PYTHON) pyproject.toml requirements.txt
$(VENV)/bin/pip install -U pip
$(VENV)/bin/pip install -r requirements.txt
$(VENV)/bin/pip install -e ".[dev]"
touch $(INSTALL_STAMP)
$(PYTHON):
python3 -m venv $(VENV)
.PHONY: clean
clean: ## remove all build, test, coverage and Python artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
rm -f .coverage
rm -fr .pytest_cache
.PHONY: lint
lint: install ## check code style
$(VENV)/bin/ruff check src tests
$(VENV)/bin/ruff format --check src tests
.PHONY: lint
format: install ## apply code style
$(VENV)/bin/ruff check --fix src tests
$(VENV)/bin/ruff format src tests
.PHONY: test
test: install ## run tests quickly with the default Python
$(VENV)/bin/pytest --cov-report term-missing --cov autograph_utils