This repository was archived by the owner on Feb 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (78 loc) · 3.09 KB
/
Makefile
File metadata and controls
98 lines (78 loc) · 3.09 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
# Makefile for Python project
.DELETE_ON_ERROR:
.PHONY: FORCE
.PRECIOUS:
.SUFFIXES:
.DEFAULT_GOAL := help
default: help
define INFO_MESSAGE
@echo "⏩\033[1;38;5;208m$(1)\033[0m"
endef
############################################################################
#= BASIC USAGE
.PHONY: help
help: ## Display help message
@./sbin/makefile-extract-documentation ${MAKEFILE_LIST}
############################################################################
#= SETUP, INSTALLATION, PACKAGING
install: devready
.PHONY: devready
devready: ## Prepare local dev env: Create virtual env, install the pre-commit hooks
$(call INFO_MESSAGE, Prepare local dev env: Create virtual env and install the pre-commit hooks)
uv sync --dev
uv run pre-commit install
$(call INFO_MESSAGE, Activate the virtual env with \`source .venv/bin/activate\`)
.PHONY: build
build: ## Build package
$(call INFO_MESSAGE, "Build package")
rm -fr dist
uv build
.PHONY: publish
publish: build ## Publish package to PyPI
$(call INFO_MESSAGE, "Publish package to PyPI")
uv publish # Requires UV_PUBLISH_TOKEN or Trusted Publishing setup
############################################################################
#= FORMATTING, TESTING, AND CODE QUALITY
.PHONY: cqa
cqa: ## Run code quality assessments
$(call INFO_MESSAGE, "Checking lock file consistency")
uv lock --locked
$(call INFO_MESSAGE, "Linting and reformatting files")
uv run pre-commit run
$(call INFO_MESSAGE, "Checking for obsolete dependencies")
uv run deptry src
.PHONY: test
test: ## Test the code with pytest
@echo "🚀 Testing code: Running pytest"
uv run pytest
############################################################################
#= DOCUMENTATION
.PHONY: docs-serve
docs-serve: ## Build and serve the documentation
$(call INFO_MESSAGE, "Build and serve docs for local development")
uv run mkdocs serve
.PHONY: docs-test
docs-test: ## Test if documentation can be built without warnings or errors
$(call INFO_MESSAGE, "Testing whether docs can be build")
uv run mkdocs build -s
############################################################################
#= CLEANUP
.PHONY: clean
clean: ## Remove temporary and backup files
$(call INFO_MESSAGE, "Remove temporary and backup files")
find . \( -name "*~" -o -name "*.bak" \) -exec rm -frv {} +
.PHONY: cleaner
cleaner: clean ## Remove files and directories that are easily rebuilt
$(call INFO_MESSAGE, "Remove files and directories that are easily rebuilt")
rm -frv .cache .DS_Store .pytest_cache .ruff_cache build coverage.xml dist docs/_build site
find . \( -name __pycache__ -type d \) -exec rm -frv {} +
find . \( -name "*.pyc" -o -name "*.egg-info" \) -exec rm -frv {} +
find . \( -name "*.orig" -o -name "*.rej" \) -exec rm -frv {} +
.PHONY: cleanest
cleanest: cleaner ## Remove files and directories that can be rebuilt
$(call INFO_MESSAGE, "Remove files and directories that can be rebuilt")
rm -frv .eggs .tox .venv venv
.PHONY: distclean
distclean: cleanest ## Remove untracked files and other detritus
@echo "❌ Remove untracked files and other detritus -- Too dangerous... do this yourself"
# git clean -df