Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add make help command #378

Merged
merged 2 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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