diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index abdece8..e5fa0dd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,3 +8,5 @@ 6. Run `make format` to format code 7. Run `make lint` to lint code 8. run `make docs` to build docs and `make docs-serve` to serve docs locally + +Run `make help` to see all available commands. diff --git a/Makefile b/Makefile index 91610f0..b98bf4d 100644 --- a/Makefile +++ b/Makefile @@ -2,52 +2,57 @@ .DEFAULT_GOAL := all -.PHONY: .uv # Check that uv is installed -.uv: +# Thanks to https://dwmkerr.com/makefile-help-command/ +.PHONY: help +help: # Show help for each of the Makefile recipes. + @grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done + +.PHONY: .uv +.uv: # Check that uv is installed @uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/' -.PHONY: .pre-commit # Check that pre-commit is installed -.pre-commit: +.PHONY: .pre-commit +.pre-commit: # Check that pre-commit is installed @pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/' -.PHONY: install # Install the package, dependencies, and pre-commit for local development -install: .uv .pre-commit +.PHONY: install +install: .uv .p # Install the package, dependencies, and pre-commit for local developmentre-commit uv sync --frozen pre-commit install --install-hooks -.PHONY: format # Format the code -format: +.PHONY: format +format: # Format the code uv run ruff format uv run ruff check --fix -.PHONY: lint # Lint the code -lint: +.PHONY: lint +lint: # Lint the code uv run ruff check uv run ruff format --check --diff -.PHONY: typecheck # Typecheck the code -typecheck: +.PHONY: typecheck +typecheck: # Typecheck the code uv run mypy . -.PHONY: test # Run the tests -test: +.PHONY: test +test: # Run the tests uv run pytest -vv -.PHONY: testcov # Run tests and generate a coverage report -testcov: test +.PHONY: testcov +testcov: test # Run tests and generate a coverage report @echo "building coverage html" uv run coverage html --show-contexts -.PHONY: test-fix-vcr # Run the last failed tests and rewrite the VCR cassettes -test-fix-vcr: +.PHONY: test-fix-vcr +test-fix-vcr: # Run the last failed tests and rewrite the VCR cassettes uv run pytest -vv --last-failed --last-failed-no-failures=none --record-mode=rewrite -.PHONY: docs # Build the documentation -docs: +.PHONY: docs +docs: # Build the documentation uv run mkdocs build -.PHONY: docs-serve # Build and serve the documentation -docs-serve: +.PHONY: docs-serve +docs-serve: # Build and serve the documentation uv run mkdocs serve .PHONY: all