-
Notifications
You must be signed in to change notification settings - Fork 363
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (56 loc) · 2.52 KB
/
Makefile
File metadata and controls
79 lines (56 loc) · 2.52 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
.DEFAULT_GOAL := help
PYTHON_VERSION ?= 3.10
IMAGE = testcontainers-python:${PYTHON_VERSION}
PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/*)))
UPLOAD = $(addsuffix /upload,${PACKAGES})
TESTS = $(addsuffix /tests,$(filter-out meta,${PACKAGES}))
TESTS_DIND = $(addsuffix -dind,${TESTS})
DOCTESTS = $(addsuffix /doctests,$(filter-out modules/README.md,${PACKAGES}))
install: ## Set up the project for development
uv sync --all-extras
uv run pre-commit install
build: ## Build the python package
uv build && uv run twine check dist/*
tests: ${TESTS} ## Run tests for each package
${TESTS}: %/tests:
uv run coverage run --parallel -m pytest -v $*/tests
coverage: ## Target to combine and report coverage.
uv run coverage combine
uv run coverage report
uv run coverage xml
uv run coverage html
lint: ## Lint all files in the project, which we also run in pre-commit
uv run pre-commit run --all-files
mypy-core: ## Run mypy on the core package
uv run mypy --config-file pyproject.toml core
mypy-core-report: ## Generate a report for mypy on the core package
uv run mypy --config-file pyproject.toml core | uv run python scripts/mypy_report.py
docs: ## Build the docs for the project
uv run --all-extras sphinx-build -nW . docs/_build
# Target to build docs watching for changes as per https://stackoverflow.com/a/21389615
docs-watch :
uv run sphinx-autobuild . docs/_build # requires 'pip install sphinx-autobuild'
doctests: ${DOCTESTS} ## Run doctests found across the documentation.
uv run --all-extras sphinx-build -b doctest . docs/_build
${DOCTESTS}: %/doctests: ## Run doctests found for a module.
uv run --all-extras sphinx-build -b doctest -c doctests $* docs/_build
clean: ## Remove generated files.
rm -rf docs/_build
rm -rf build
rm -rf dist
rm -rf */*.egg-info
clean-all: clean ## Remove all generated files and reset the local virtual environment
rm -rf .venv
# Targets that do not generate file-level artifacts.
.PHONY: clean docs doctests image tests ${TESTS}
# Implements this pattern for autodocumenting Makefiles:
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
#
# Picks up all comments that start with a ## and are at the end of a target definition line.
.PHONY: help
help: ## Display command usage
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
## --------------------------------------
.PHONY: serve-docs
serve-docs:
uv run mkdocs serve -f mkdocs.yml -a 127.0.0.1:8000