-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (52 loc) · 1.49 KB
/
Makefile
File metadata and controls
65 lines (52 loc) · 1.49 KB
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
UNAME := $(shell uname)
UV := uv run
# define a macro to print help message
define PRINT_HELP_PYSCRIPT
import re, sys
BOLD = '\033[1m'
BLUE = '\033[94m'
END = '\033[0m'
print("Usage: make <target>\n")
print(BOLD + "%-20s%s" % ("target", "description") + END)
for line in sys.stdin:
match = re.match(r'^([a-zA-Z0-9_/\\-]+\.?.*?):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print( BLUE + "%-20s" % (target) + END + "%s" % (help))
endef
export PRINT_HELP_PYSCRIPT
default: help
.PHONY: help
help: ## Show this help
@$(UV) python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
.PHONY: clean clean-build clean-pyc clean-test
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts
$(UV) ruff clean
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -fr {} +
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
.PHONY: format
format: ## format code
@echo "Format docstrings"
@$(UV) docformatter --config ./pyproject.toml --recursive --in-place ./src
@echo "Format code with black"
@$(UV) black .
.PHONY: install
install: ## install the package to the active Python's site-packages
@uv sync
.PHONY: lint
lint: ## check style with pylint
$(UV) ruff check --fix ./src