Skip to content

Commit

Permalink
Add make help command (#378)
Browse files Browse the repository at this point in the history
* Add make help command

* Mention make help in contributing doc
  • Loading branch information
jackmpcollins authored Nov 24, 2024
1 parent d98045f commit 8f29f24
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
49 changes: 27 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8f29f24

Please sign in to comment.