@@ -15,49 +15,49 @@ USE_MATURIN = $(shell [ "$$VIRTUAL_ENV" != "" ] && (which maturin))
1515 @uv -V || echo ' Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
1616
1717.PHONY : .pre-commit # # Check that pre-commit is installed
18- .pre-commit :
19- @pre-commit -V || echo ' Please install pre-commit: https://pre-commit.com/ '
18+ .pre-commit : .uv
19+ @uv run pre-commit -V || uv pip install pre-commit
2020
21- .PHONY : install
21+ .PHONY : install # # Install the package, dependencies, and pre-commit for local development
2222install : .uv .pre-commit
23- uv pip install -U wheel
2423 uv sync --frozen --group all
25- uv pip install -v -e .
26- pre-commit install
24+ uv pip install pre-commit
25+ uv run pre-commit install --install-hooks
2726
2827.PHONY : rebuild-lockfiles # # Rebuild lockfiles from scratch, updating all dependencies
2928rebuild-lockfiles : .uv
3029 uv lock --upgrade
3130
32- .PHONY : install-rust-coverage
31+ .PHONY : install-rust-coverage # # Install Rust coverage tools
3332install-rust-coverage :
3433 cargo install rustfilt coverage-prepare
3534 rustup component add llvm-tools-preview
3635
37- .PHONY : install-pgo
36+ .PHONY : install-pgo # # Install Rust PGO tools
37+ install-pgo :
3838 rustup component add llvm-tools-preview
3939
40- .PHONY : build-dev
40+ .PHONY : build-dev # # Build the development version of the package
4141build-dev :
4242 @rm -f python/pydantic_core/* .so
4343 uv run maturin develop --uv
4444
45- .PHONY : build-prod
45+ .PHONY : build-prod # # Build the production version of the package
4646build-prod :
4747 @rm -f python/pydantic_core/* .so
4848 uv run maturin develop --uv --release
4949
50- .PHONY : build-profiling
50+ .PHONY : build-profiling # # Build the profiling version of the package
5151build-profiling :
5252 @rm -f python/pydantic_core/* .so
5353 uv run maturin develop --uv --profile profiling
5454
55- .PHONY : build-coverage
55+ .PHONY : build-coverage # # Build the coverage version of the package
5656build-coverage :
5757 @rm -f python/pydantic_core/* .so
5858 RUSTFLAGS=' -C instrument-coverage' uv run maturin develop --uv --release
5959
60- .PHONY : build-pgo
60+ .PHONY : build-pgo # # Build the PGO version of the package
6161build-pgo :
6262 @rm -f python/pydantic_core/* .so
6363 $(eval PROFDATA := $(shell mktemp -d) )
@@ -69,44 +69,44 @@ build-pgo:
6969 @rm -rf $(PROFDATA )
7070
7171
72- .PHONY : build-wasm
72+ .PHONY : build-wasm # # Build the WebAssembly version of the package
7373build-wasm :
7474 @echo ' This requires python 3.12, maturin and emsdk to be installed'
7575 uv run maturin build --release --target wasm32-unknown-emscripten --out dist -i 3.12
7676 ls -lh dist
7777
78- .PHONY : format
78+ .PHONY : format # # Auto-format rust and python source files
7979format :
8080 uv run ruff check --fix $(sources )
8181 uv run ruff format $(sources )
8282 cargo fmt
8383
84- .PHONY : lint-python
84+ .PHONY : lint-python # # Lint python source files
8585lint-python :
8686 uv run ruff check $(sources )
8787 uv run ruff format --check $(sources )
8888 uv run griffe dump -f -d google -LWARNING -o/dev/null python/pydantic_core
8989 $(mypy-stubtest )
9090
91- .PHONY : lint-rust
91+ .PHONY : lint-rust # # Lint rust source files
9292lint-rust :
9393 cargo fmt --version
9494 cargo fmt --all -- --check
9595 cargo clippy --version
9696 cargo clippy --tests -- -D warnings
9797
98- .PHONY : lint
98+ .PHONY : lint # # Lint rust and python source files
9999lint : lint-python lint-rust
100100
101- .PHONY : pyright
101+ .PHONY : pyright # # Perform type-checking with pyright
102102pyright :
103103 uv run pyright
104104
105- .PHONY : test
105+ .PHONY : test # # Run all tests
106106test :
107107 uv run pytest
108108
109- .PHONY : testcov
109+ .PHONY : testcov # # Run tests and generate a coverage report
110110testcov : build-coverage
111111 @rm -rf htmlcov
112112 @mkdir -p htmlcov
@@ -115,10 +115,10 @@ testcov: build-coverage
115115 coverage html -d htmlcov/python
116116 coverage-prepare html python/pydantic_core/* .so
117117
118- .PHONY : all
118+ .PHONY : all # # Run the standard set of checks performed in CI
119119all : format build-dev lint test
120120
121- .PHONY : clean
121+ .PHONY : clean # # Clear local caches and build artifacts
122122clean :
123123 rm -rf ` find . -name __pycache__`
124124 rm -f ` find . -type f -name ' *.py[co]' `
@@ -133,3 +133,10 @@ clean:
133133 rm -rf build
134134 rm -rf perf.data*
135135 rm -rf python/pydantic_core/* .so
136+
137+ .PHONY : help # # Display this message
138+ help :
139+ @grep -E \
140+ ' ^.PHONY: .*?## .*$$' $(MAKEFILE_LIST ) | \
141+ sort | \
142+ awk ' BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
0 commit comments