|
1 | | -.PHONY: install |
2 | | -install: ## Install the virtual environment and install the pre-commit hooks |
3 | | - @command -v uv >/dev/null 2>&1 || { echo "⚡ uv not found, installing..."; curl -LsSf https://astral.sh/uv/install.sh | sh; } |
4 | | - @echo "🚀 Creating virtual environment using uv" |
5 | | - @uv sync --no-dev |
| 1 | +# This Makefile is just here to allow auto-completion in the terminal. |
| 2 | + |
| 3 | +actions = \ |
| 4 | + build \ |
| 5 | + check \ |
| 6 | + check-api \ |
| 7 | + check-docs \ |
| 8 | + check-quality \ |
| 9 | + check-types \ |
| 10 | + clean \ |
| 11 | + clean_cache \ |
| 12 | + coverage \ |
| 13 | + {%- if dockerfile %} |
| 14 | + docker-build \ |
| 15 | + docker-start \ |
| 16 | + docker-stop \ |
| 17 | + docker-exec-check \ |
| 18 | + docker-exec-check-api \ |
| 19 | + docker-exec-check-docs \ |
| 20 | + docker-exec-check-quality \ |
| 21 | + docker-exec-check-types \ |
| 22 | + docker-exec-coverage \ |
| 23 | + docker-exec-docs \ |
| 24 | + docker-exec-test \ |
| 25 | + {%- if tox %} |
| 26 | + docker-exec-tox \ |
| 27 | + {%- endif %} |
| 28 | + {%- endif %} |
| 29 | + docs \ |
| 30 | + {%- if repository_provider == 'github' %} |
| 31 | + docs-deploy \ |
| 32 | + {%- endif %} |
| 33 | + format \ |
| 34 | + {%- if publish_to_pypi %} |
| 35 | + publish \ |
| 36 | + {%- endif %} |
| 37 | + {%- if with_conventional_commits %} |
| 38 | + release \ |
| 39 | + {%- endif %} |
| 40 | + setup \ |
| 41 | + setup-dev \ |
| 42 | + test {% if tox %}\ |
| 43 | + tox |
| 44 | + {%- endif %} |
| 45 | + |
| 46 | + |
| 47 | +.PHONY: $(actions) |
| 48 | +$(actions): |
| 49 | + @uv run duty "$@" |
6 | 50 |
|
7 | | -.PHONY: install-dev |
8 | | -install-dev: ## Install the virtual environment with the dev dependencies and install the pre-commit hooks |
9 | | - @command -v uv >/dev/null 2>&1 || { echo "⚡ uv not found, installing..."; curl -LsSf https://astral.sh/uv/install.sh | sh; } |
10 | | - @echo "🚀 Creating virtual environment using uv" |
11 | | - @uv sync --all-extras |
12 | | - @uv run pre-commit install -f |
13 | | - |
14 | | -.PHONY: check |
15 | | -check: ## Run code quality tools. |
16 | | - @echo "🚀 Checking lock file consistency with 'pyproject.toml'" |
17 | | - @uv lock --locked |
18 | | - @echo "🚀 Running pre-commit" |
19 | | - @uv run pre-commit run -a |
20 | | - |
21 | | -.PHONY: test |
22 | | -test: ## Test the code with pytest |
23 | | - @echo "🚀 Testing code: Running pytest" |
24 | | - @uv run python -m pytest --doctest-modules --cov --cov-config=pyproject.toml --cov-report=xml --cov-report=term-missing -vv |
25 | | - |
26 | | -.PHONY: tox |
27 | | -tox: ## Test Python compatibility with Tox |
28 | | - @echo "🚀 Testing compatibility with multiple Python version: Running Tox" |
29 | | - @uv run tox |
30 | | - |
31 | | -.PHONY: build |
32 | | -build: clean-build ## Build wheel file |
33 | | - @echo "🚀 Creating wheel file" |
34 | | - @uvx --from build pyproject-build --installer uv |
35 | | - |
36 | | -.PHONY: clean-build |
37 | | -clean-build: ## Clean build artifacts |
38 | | - @echo "🚀 Removing build artifacts" |
39 | | - @uv run python -c "import shutil; import os; shutil.rmtree('dist') if os.path.exists('dist') else None" |
40 | | - |
41 | | -{%- if publish_to_pypi %} |
42 | | -.PHONY: publish |
43 | | -publish: ## Publish a release to PyPI. |
44 | | - @echo "🚀 Publishing." |
45 | | - @uvx twine upload --repository-url https://upload.pypi.org/legacy/ dist/* |
46 | | - |
47 | | -.PHONY: build-and-publish |
48 | | -build-and-publish: build publish ## Build and publish. |
49 | | -{%- endif %} |
50 | | - |
51 | | -.PHONY: docs-test |
52 | | -docs-test: ## Test if documentation can be built without warnings or errors |
53 | | - @uv run mkdocs build -s |
54 | | - |
55 | | -.PHONY: docs |
56 | | -docs: ## Build and serve the documentation |
57 | | - @uv run mkdocs serve |
58 | 51 |
|
59 | 52 | .PHONY: help |
60 | 53 | help: |
61 | | - @uv run python -c "import re; \ |
62 | | - [[print(f'\033[36m{m[0]:<20}\033[0m {m[1]}') for m in re.findall(r'^([a-zA-Z_-]+):.*?## (.*)$$', open(makefile).read(), re.M)] for makefile in ('$(MAKEFILE_LIST)').strip().split()]" |
| 54 | + @uv run duty --list |
63 | 55 |
|
64 | 56 | .DEFAULT_GOAL := help |
0 commit comments