Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
146 lines (117 loc) · 4.57 KB
/
Copy pathMakefile
File metadata and controls
146 lines (117 loc) · 4.57 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# 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 git hooks (prek)
$(call INFO_MESSAGE, Prepare local dev env: Create virtual env and install the git hooks (prek))
uv sync --dev
uv run prek install -f
$(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 prek 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
.PHONY: test-coverage
test-coverage: ## Test the code with pytest and generate coverage report
@echo "🚀 Testing code: Running pytest with coverage"
uv run pytest --cov=src --cov-report=term-missing
.PHONY: test-matrix
test-matrix: ## Test with each supported Python version (via nox)
uv run nox
# to be incorporated
# test-learn:
# VCR_RECORD_MODE=new_episodes pytest -x
############################################################################
#= 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
############################################################################
#= UTILITIES
.PHONY: show-outdated-deps
show-outdated-deps: ## List outdated dependencies
$(call INFO_MESSAGE, "Listing outdated dependencies")
uv pip list --outdated
.PHONY: upgrade-deps
upgrade-deps: ## Upgrade installed dependencies
$(call INFO_MESSAGE, "Upgrading dependencies")
uv lock --upgrade
.PHONY: bump-deps
bump-deps: ## Bumping versions of installed dependencies
$(call INFO_MESSAGE, "Bumping dependency versions")
uv-bump
############################################################################
#= 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
## <LICENSE>
## Copyright 2026 Committers
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
## </LICENSE>