-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (85 loc) · 2.76 KB
/
Makefile
File metadata and controls
105 lines (85 loc) · 2.76 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# =========================================================
# Generic Python Project Makefile
# =========================================================
# Usage:
# make <target>
#
# Run `make help` to see available targets.
# =========================================================
# Variables
PYTHON ?= python3
PIP ?= $(PYTHON) -m pip
DIST_DIR := dist
# Default target
.PHONY: all
all: check build ## Run checks and build the package
# ----------------------------
# Dependency Management
# ----------------------------
.PHONY: deps
deps: ## Install dependencies from requirements.txt
$(PIP) install -r requirements.txt
# ----------------------------
# Quality & Testing
# ----------------------------
.PHONY: test lint typecheck format check coverage
# test: ## Run test suite with pytest
# $(PYTHON) -m pytest -v tests
# coverage: ## Run tests with coverage report
# $(PYTHON) -m pytest --cov=src --cov-report=term-missing
# lint: ## Lint code with ruff
# ruff check src tests
#
# typecheck: ## Type-check with mypy
# mypy src tests
format: ## Autoformat code with ruff
ruff format src tests
# check: lint typecheck test ## Run lint, typecheck, and test
# ----------------------------
# Build & Packaging
# ----------------------------
.PHONY: build clean clean-preview install
build: clean ## Build distribution package
packaging/build_all.sh
clean: ## Remove items from CLEANUP section in .gitignore
@tmpfile=$$(mktemp); \
sed -n '/# >>> CLEANUP/,/# <<< CLEANUP/p' .gitignore \
| grep -v '^#' \
| grep -v '^[[:space:]]*$$' > $$tmpfile; \
git ls-files --ignored --exclude-from=$$tmpfile --others --directory -z \
| xargs -0 rm -rf; \
rm $$tmpfile;
# $(MAKE) -C docs/_docs_tools clean
clean-preview: ## Show what would be deleted by the `clean` target
@tmpfile=$$(mktemp); \
sed -n '/# >>> CLEANUP/,/# <<< CLEANUP/p' .gitignore \
| grep -v '^#' \
| grep -v '^[[:space:]]*$$' > $$tmpfile; \
git ls-files --ignored --exclude-from=$$tmpfile --others --directory; \
rm $$tmpfile
# install: build ## Install built wheel into environment
# $(PIP) install $(DIST_DIR)/*.whl
# # ----------------------------
# # Documentation
# # ----------------------------
# .PHONY: docs
#
# docs: ## Build Sphinx documentation
# $(MAKE) -C docs/_docs_tools all
# # ----------------------------
# # Release Helpers
# # ----------------------------
# .PHONY: dist upload
#
# dist: build ## List built distributions
# ls -lh $(DIST_DIR)
#
# upload: build ## Upload package to PyPI (requires twine)
# twine upload $(DIST_DIR)/*
# ----------------------------
# Help
# ----------------------------
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'