@@ -14,50 +14,45 @@ USE_MATURIN = $(shell [ "$$VIRTUAL_ENV" != "" ] && (which maturin))
1414.uv :
1515 @uv -V || echo ' Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
1616
17- .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/'
20-
21- .PHONY : install
22- install : .uv .pre-commit
23- uv pip install -U wheel
17+ .PHONY : install # # Install the package, dependencies, and pre-commit for local development
18+ install : .uv
2419 uv sync --frozen --group all
25- uv pip install -v -e .
26- pre-commit install
20+ uv run pre-commit install --install-hooks
2721
2822.PHONY : rebuild-lockfiles # # Rebuild lockfiles from scratch, updating all dependencies
2923rebuild-lockfiles : .uv
3024 uv lock --upgrade
3125
32- .PHONY : install-rust-coverage
26+ .PHONY : install-rust-coverage # # Install Rust coverage tools
3327install-rust-coverage :
3428 cargo install rustfilt coverage-prepare
3529 rustup component add llvm-tools-preview
3630
37- .PHONY : install-pgo
31+ .PHONY : install-pgo # # Install Rust PGO tools
32+ install-pgo :
3833 rustup component add llvm-tools-preview
3934
40- .PHONY : build-dev
35+ .PHONY : build-dev # # Build the development version of the package
4136build-dev :
4237 @rm -f python/pydantic_core/* .so
4338 uv run maturin develop --uv
4439
45- .PHONY : build-prod
40+ .PHONY : build-prod # # Build the production version of the package
4641build-prod :
4742 @rm -f python/pydantic_core/* .so
4843 uv run maturin develop --uv --release
4944
50- .PHONY : build-profiling
45+ .PHONY : build-profiling # # Build the profiling version of the package
5146build-profiling :
5247 @rm -f python/pydantic_core/* .so
5348 uv run maturin develop --uv --profile profiling
5449
55- .PHONY : build-coverage
50+ .PHONY : build-coverage # # Build the coverage version of the package
5651build-coverage :
5752 @rm -f python/pydantic_core/* .so
5853 RUSTFLAGS=' -C instrument-coverage' uv run maturin develop --uv --release
5954
60- .PHONY : build-pgo
55+ .PHONY : build-pgo # # Build the PGO version of the package
6156build-pgo :
6257 @rm -f python/pydantic_core/* .so
6358 $(eval PROFDATA := $(shell mktemp -d) )
@@ -69,44 +64,44 @@ build-pgo:
6964 @rm -rf $(PROFDATA )
7065
7166
72- .PHONY : build-wasm
67+ .PHONY : build-wasm # # Build the WebAssembly version of the package
7368build-wasm :
7469 @echo ' This requires python 3.12, maturin and emsdk to be installed'
7570 uv run maturin build --release --target wasm32-unknown-emscripten --out dist -i 3.12
7671 ls -lh dist
7772
78- .PHONY : format
73+ .PHONY : format # # Auto-format rust and python source files
7974format :
8075 uv run ruff check --fix $(sources )
8176 uv run ruff format $(sources )
8277 cargo fmt
8378
84- .PHONY : lint-python
79+ .PHONY : lint-python # # Lint python source files
8580lint-python :
8681 uv run ruff check $(sources )
8782 uv run ruff format --check $(sources )
8883 uv run griffe dump -f -d google -LWARNING -o/dev/null python/pydantic_core
8984 $(mypy-stubtest )
9085
91- .PHONY : lint-rust
86+ .PHONY : lint-rust # # Lint rust source files
9287lint-rust :
9388 cargo fmt --version
9489 cargo fmt --all -- --check
9590 cargo clippy --version
9691 cargo clippy --tests -- -D warnings
9792
98- .PHONY : lint
93+ .PHONY : lint # # Lint rust and python source files
9994lint : lint-python lint-rust
10095
101- .PHONY : pyright
96+ .PHONY : pyright # # Perform type-checking with pyright
10297pyright :
10398 uv run pyright
10499
105- .PHONY : test
100+ .PHONY : test # # Run all tests
106101test :
107102 uv run pytest
108103
109- .PHONY : testcov
104+ .PHONY : testcov # # Run tests and generate a coverage report
110105testcov : build-coverage
111106 @rm -rf htmlcov
112107 @mkdir -p htmlcov
@@ -115,10 +110,10 @@ testcov: build-coverage
115110 coverage html -d htmlcov/python
116111 coverage-prepare html python/pydantic_core/* .so
117112
118- .PHONY : all
113+ .PHONY : all # # Run the standard set of checks performed in CI
119114all : format build-dev lint test
120115
121- .PHONY : clean
116+ .PHONY : clean # # Clear local caches and build artifacts
122117clean :
123118 rm -rf ` find . -name __pycache__`
124119 rm -f ` find . -type f -name ' *.py[co]' `
@@ -133,3 +128,10 @@ clean:
133128 rm -rf build
134129 rm -rf perf.data*
135130 rm -rf python/pydantic_core/* .so
131+
132+ .PHONY : help # # Display this message
133+ help :
134+ @grep -E \
135+ ' ^.PHONY: .*?## .*$$' $(MAKEFILE_LIST ) | \
136+ sort | \
137+ awk ' BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
0 commit comments