-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (67 loc) · 2.19 KB
/
Copy pathMakefile
File metadata and controls
89 lines (67 loc) · 2.19 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Required executables
ifeq (, $(shell which python))
$(error "No python on PATH.")
endif
ifeq (, $(shell uv help))
$(error "uv not available in Python installation.")
endif
export LC_ALL = C
export LANG = C.UTF-8
PY_FILES := src tests
.PHONY: help all clean clear-cache venv build test mypy lint lint-fix format format-check outdated update run-venv install-run audit pre-commit
.DEFAULT_GOAL := all
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
# Bundle tasks
all: clean venv build ## Clean, create venv, and run full build (default)
@echo Executed default build pipeline
clean: ## Remove .venv, caches, and build artifacts
@echo Clean project base
find . -type d \
-name ".venv" -o \
-name ".tox" -o \
-name ".coverage" -o \
-name ".ropeproject" -o \
-name ".mypy_cache" -o \
-name ".ruff_cache" -o \
-name ".pytest_cache" -o \
-name "__pycache__" -o \
-iname "*.egg-info" -o \
-name "build" -o \
-name "dist" \
|xargs rm -rfv
clear-cache: ## Clear uv dependency cache
uv cache clean
venv: clean ## Clean and recreate virtual environment
uv sync
build: test mypy lint format ## Run the entire build chain
uv build
test: ## Run pytest test suite
uv run py.test tests
mypy: ## Run mypy type checking
uv run mypy $(PY_FILES)
lint: ## Run ruff linting
uv run ruff check $(PY_FILES)
lint-fix: ## Auto-fix linting issues with ruff
uv run ruff check --fix $(PY_FILES)
format: ## Format code with ruff
uv run ruff format $(PY_FILES)
format-check: ## Check code formatting (no changes)
uv run ruff format --check $(PY_FILES)
outdated: ## Show outdated dependencies
uv pip list --outdated --exclude-editable
update: ## Update all dependencies
uv sync --upgrade
run-venv: ## Run module directly in venv
uv run python -m my_module
install-run: ## Install package and run CLI
uv pip install --upgrade .
@echo --- Note: The next command might fail before you reload your shell
my_module_cli
audit: ## Scan dependencies for known CVEs
uv run pip-audit --skip-editable
pre-commit: ## Run all pre-commit hooks on all files
uv run pre-commit run --all-files