|
1 | 1 | .ONESHELL: |
2 | 2 | .DEFAULT_GOAL:=help |
3 | 3 | SHELL:=/bin/bash |
4 | | -PACKAGE_NAME:=src/buzz |
| 4 | +PACKAGE_TARGET:=src/buzz |
5 | 5 |
|
6 | | -.PHONY: test |
7 | | -test: |
8 | | - uv run pytest |
9 | | - |
10 | | -.PHONY: types |
11 | | -types: |
12 | | - uv run mypy ${PACKAGE_NAME} src/demo --pretty |
13 | | - uv run basedpyright ${PACKAGE_NAME} src/demo |
14 | | - |
15 | | -.PHONY: lint |
16 | | -lint: |
17 | | - uv run ruff check ${PACKAGE_NAME} tests src/demo |
18 | 6 |
|
19 | | -.PHONY: qa |
20 | | -qa: test lint types |
21 | | - echo "All quality checks pass!" |
| 7 | +# ==== Helpers ========================================================================================================= |
| 8 | +.PHONY: confirm |
| 9 | +confirm: ## Don't use this directly |
| 10 | + @echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ] |
22 | 11 |
|
23 | | -.PHONY: format |
24 | | -format: |
25 | | - uv run ruff format ${PACKAGE_NAME} tests src/demo |
26 | 12 |
|
27 | | -.PHONY: docs |
28 | | -docs: |
29 | | - uv run mkdocs build --config-file=docs/mkdocs.yaml |
30 | | - |
31 | | -.PHONY: docs-serve |
32 | | -docs-serve: |
33 | | - uv run mkdocs serve --config-file=docs/mkdocs.yaml --dev-addr=localhost:10000 |
| 13 | +.PHONY: help |
| 14 | +help: ## Show help message |
| 15 | + @awk 'BEGIN {FS = ": .*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_\/-]+(\\:[$$()% 0-9a-zA-Z_\/-]+)*:.*?##/ { gsub(/\\:/,":", $$1); printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
34 | 16 |
|
35 | 17 | .PHONY: clean |
36 | | -clean: |
| 18 | +clean: ## Clean up build artifacts and other junk |
37 | 19 | @rm -rf .venv |
38 | 20 | @uv run pyclean . --debris |
39 | 21 | @rm -rf dist |
40 | | - @rm -rf .mypy_cache |
41 | | - @rm -rf .pytest_cache |
42 | 22 | @rm -rf .ruff_cache |
| 23 | + @rm -rf .pytest_cache |
| 24 | + @rm -rf .mypy_cache |
43 | 25 | @rm -f .coverage* |
44 | 26 | @rm -f .junit.xml |
45 | 27 |
|
46 | | -# Recipe stolen from: https://gist.github.com/prwhite/8168133?permalink_comment_id=4160123#gistcomment-4160123 |
47 | | -.PHONY: help |
48 | | -help: ## Show help message |
49 | | - @awk 'BEGIN {FS = ": .*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+(\\:[$$()% 0-9a-zA-Z_-]+)*:.*?##/ { gsub(/\\:/,":", $$1); printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 28 | + |
| 29 | +# ==== Quality Control ================================================================================================= |
| 30 | +.PHONY: qa/test |
| 31 | +qa: qa/full ## Shortcut for qa/full |
| 32 | + |
| 33 | +.PHONY: qa/test |
| 34 | +qa/test: ## Run the tests |
| 35 | + uv run pytest |
| 36 | + |
| 37 | +.PHONY: qa/types |
| 38 | +qa/types: ## Run static type checks |
| 39 | + uv run mypy ${PACKAGE_TARGET} tests src/demo --pretty |
| 40 | + uv run basedpyright ${PACKAGE_TARGET} tests src/demo |
| 41 | + |
| 42 | +.PHONY: qa/lint |
| 43 | +qa/lint: ## Run linters |
| 44 | + uv run ruff check ${PACKAGE_TARGET} tests src/demo |
| 45 | + uv run typos ${PACKAGE_TARGET} tests src/demo |
| 46 | + |
| 47 | +.PHONY: qa/full |
| 48 | +qa/full: qa/test qa/lint qa/types ## Run the full set of quality checks |
| 49 | + @echo "All quality checks pass!" |
| 50 | + |
| 51 | +.PHONY: qa/format |
| 52 | +qa/format: ## RUn code formatter |
| 53 | + uv run ruff format ${PACKAGE_TARGET} tests src/demo |
| 54 | + |
| 55 | + |
| 56 | +# ==== Documentation =================================================================================================== |
| 57 | +.PHONY: docs |
| 58 | +docs: docs/serve ## Shortcut for docs/serve |
| 59 | + |
| 60 | +.PHONY: docs/build |
| 61 | +docs/build: ## Build the documentation |
| 62 | + uv run mkdocs build --config-file=docs/mkdocs.yaml |
| 63 | + |
| 64 | +.PHONY: docs/serve |
| 65 | +docs/serve: ## Build the docs and start a local dev server |
| 66 | + uv run mkdocs serve --config-file=docs/mkdocs.yaml --dev-addr=localhost:10000 |
| 67 | + |
| 68 | + |
| 69 | +# ==== Demo Commands =================================================================================================== |
| 70 | +.PHONY: demo |
| 71 | +demo: demo/run ## Shortcut for demo/run |
| 72 | + |
| 73 | +.PHONY: demo/run |
| 74 | +demo/run: ## Run the app in debug mode |
| 75 | + uv run py-buzz-demo |
| 76 | + |
| 77 | +.PHONY: demo/debug |
| 78 | +demo/debug: ## Run the app in debug mode |
| 79 | + uv run debugpy --listen localhost:5678 --wait-for-client py-buzz-demo |
0 commit comments