Skip to content

Commit 49e8f0b

Browse files
authored
added makefile help target (#226)
1 parent 84c1190 commit 49e8f0b

File tree

1 file changed

+49
-36
lines changed

1 file changed

+49
-36
lines changed

Makefile

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
.DEFAULT_GOAL := all
22

3-
.PHONY: .uv # Check that uv is installed
4-
.uv:
3+
.PHONY: .uv
4+
.uv: ## Check that uv is installed
55
@uv --version || echo 'Please install uv: https://docs.astral.sh/uv/getting-started/installation/'
66

7-
.PHONY: .pre-commit # Check that pre-commit is installed
8-
.pre-commit:
7+
.PHONY: .pre-commit
8+
.pre-commit: ## Check that pre-commit is installed
99
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'
1010

11-
.PHONY: install # Install the package, dependencies, and pre-commit for local development
12-
install: .uv .pre-commit
11+
.PHONY: install
12+
install: .uv .pre-commit ## Install the package, dependencies, and pre-commit for local development
1313
uv sync --frozen --all-extras --all-packages --group lint --group docs
1414
pre-commit install --install-hooks
1515

16-
.PHONY: sync # Update local packages and uv.lock
17-
sync: .uv
16+
.PHONY: sync
17+
sync: .uv ## Update local packages and uv.lock
1818
uv sync --all-extras --all-packages --group lint --group docs
1919

20-
.PHONY: format # Format the code
21-
format:
20+
.PHONY: format
21+
format: ## Format the code
2222
uv run ruff format
2323
uv run ruff check --fix --fix-only
2424

25-
.PHONY: lint # Lint the code
26-
lint:
25+
.PHONY: lint
26+
lint: ## Lint the code
2727
uv run ruff format --check
2828
uv run ruff check
2929

@@ -36,19 +36,19 @@ typecheck-pyright:
3636
typecheck-mypy:
3737
uv run mypy --strict tests/typed_agent.py
3838

39-
.PHONY: typecheck # Run static type checking
40-
typecheck: typecheck-pyright
39+
.PHONY: typecheck
40+
typecheck: typecheck-pyright ## Run static type checking
4141

42-
.PHONY: typecheck-both # Run static type checking with both Pyright and Mypy
42+
.PHONY: typecheck-both ## Run static type checking with both Pyright and Mypy
4343
typecheck-both: typecheck-pyright typecheck-mypy
4444

45-
.PHONY: test # Run tests and collect coverage data
46-
test:
45+
.PHONY: test
46+
test: ## Run tests and collect coverage data
4747
uv run coverage run -m pytest
4848
@uv run coverage report
4949

50-
.PHONY: test-all-python # Run tests on Python 3.9 to 3.13
51-
test-all-python:
50+
.PHONY: test-all-python
51+
test-all-python: ## Run tests on Python 3.9 to 3.13
5252
UV_PROJECT_ENVIRONMENT=.venv39 uv run --python 3.9 --all-extras coverage run -p -m pytest
5353
UV_PROJECT_ENVIRONMENT=.venv310 uv run --python 3.10 --all-extras coverage run -p -m pytest
5454
UV_PROJECT_ENVIRONMENT=.venv311 uv run --python 3.11 --all-extras coverage run -p -m pytest
@@ -57,27 +57,27 @@ test-all-python:
5757
@uv run coverage combine
5858
@uv run coverage report
5959

60-
.PHONY: testcov # Run tests and generate a coverage report
61-
testcov: test
60+
.PHONY: testcov
61+
testcov: test ## Run tests and generate a coverage report
6262
@echo "building coverage html"
6363
@uv run coverage html
6464

65-
.PHONY: update-examples # update documentation examples
66-
update-examples:
65+
.PHONY: update-examples
66+
update-examples: ## Update documentation examples
6767
uv run -m pytest --update-examples
6868

6969
# `--no-strict` so you can build the docs without insiders packages
70-
.PHONY: docs # Build the documentation
71-
docs:
70+
.PHONY: docs
71+
docs: ## Build the documentation
7272
uv run mkdocs build --no-strict
7373

7474
# `--no-strict` so you can build the docs without insiders packages
75-
.PHONY: docs-serve # Build and serve the documentation
76-
docs-serve:
75+
.PHONY: docs-serve
76+
docs-serve: ## Build and serve the documentation
7777
uv run mkdocs serve --no-strict
7878

79-
.PHONY: .docs-insiders-install # install insiders packages for docs if necessary
80-
.docs-insiders-install:
79+
.PHONY: .docs-insiders-install
80+
.docs-insiders-install: ## Install insiders packages for docs if necessary
8181
ifeq ($(shell uv pip show mkdocs-material | grep -q insiders && echo 'installed'), installed)
8282
@echo 'insiders packages already installed'
8383
else ifeq ($(PPPR_TOKEN),)
@@ -90,16 +90,16 @@ else
9090
mkdocs-material mkdocstrings-python
9191
endif
9292

93-
.PHONY: docs-insiders # Build the documentation using insiders packages
94-
docs-insiders: .docs-insiders-install
93+
.PHONY: docs-insiders
94+
docs-insiders: .docs-insiders-install ## Build the documentation using insiders packages
9595
uv run --no-sync mkdocs build -f mkdocs.insiders.yml
9696

97-
.PHONY: docs-serve-insiders # Build and serve the documentation using insiders packages
98-
docs-serve-insiders: .docs-insiders-install
97+
.PHONY: docs-serve-insiders
98+
docs-serve-insiders: .docs-insiders-install ## Build and serve the documentation using insiders packages
9999
uv run --no-sync mkdocs serve -f mkdocs.insiders.yml
100100

101-
.PHONY: cf-pages-build # Install uv, install dependencies and build the docs, used on CloudFlare Pages
102-
cf-pages-build:
101+
.PHONY: cf-pages-build
102+
cf-pages-build: ## Install uv, install dependencies and build the docs, used on CloudFlare Pages
103103
curl -LsSf https://astral.sh/uv/install.sh | sh
104104
uv python install 3.12
105105
uv sync --python 3.12 --frozen --group docs
@@ -110,4 +110,17 @@ cf-pages-build:
110110
uv run --no-sync mkdocs build -f mkdocs.insiders.yml
111111

112112
.PHONY: all
113-
all: format lint typecheck testcov
113+
all: format lint typecheck testcov ## Run code formatting, linting, static type checks, and tests with coverage report generation
114+
115+
.PHONY: help
116+
help: ## Show this help (usage: make help)
117+
@echo "Usage: make [target]"
118+
@echo "Targets:"
119+
@awk '/^[a-zA-Z0-9_-]+:.*?##/ { \
120+
helpMessage = match($$0, /## (.*)/); \
121+
if (helpMessage) { \
122+
target = $$1; \
123+
sub(/:/, "", target); \
124+
printf " \033[36m%-20s\033[0m %s\n", target, substr($$0, RSTART + 3, RLENGTH); \
125+
} \
126+
}' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)