Skip to content

Commit 828ba2e

Browse files
authored
feat(Makefile): Add self-documenting commands and re-organise (#543)
1 parent d92b135 commit 828ba2e

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

Makefile

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,50 @@
1-
.PHONY: init lint check_lint test uml html cleandocs doctest
1+
#################################################################################
2+
# GLOBALS #
3+
#################################################################################
24

3-
init:
5+
PACKAGE_DIR = causalpy
6+
7+
#################################################################################
8+
# COMMANDS #
9+
#################################################################################
10+
11+
.PHONY: init lint check_lint test uml html cleandocs doctest help
12+
13+
init: ## Install the package in editable mode
414
python -m pip install -e . --no-deps
515

6-
lint:
16+
lint: ## Run ruff linter and formatter
717
ruff check --fix .
818
ruff format .
919

10-
check_lint:
20+
check_lint: ## Check code formatting and linting without making changes
1121
ruff check .
1222
ruff format --diff --check .
1323
interrogate .
1424

15-
doctest:
25+
doctest: ## Run doctests for the causalpy module
1626
python -m pytest --doctest-modules --ignore=causalpy/tests/ causalpy/ --config-file=causalpy/tests/conftest.py
1727

18-
test:
28+
test: ## Run all tests with pytest
1929
python -m pytest
2030

21-
uml:
31+
uml: ## Generate UML diagrams from code
2232
pyreverse -o png causalpy --output-directory docs/source/_static --ignore tests
2333

24-
# Docs build commands
25-
26-
html:
34+
html: ## Build HTML documentation with Sphinx
2735
sphinx-build -b html docs/source docs/_build
2836

29-
cleandocs:
37+
cleandocs: ## Clean the documentation build directories
3038
rm -rf docs/_build
3139
rm -rf docs/source/api/generated
40+
41+
42+
#################################################################################
43+
# Self Documenting Commands #
44+
#################################################################################
45+
46+
.DEFAULT_GOAL := help
47+
48+
help: ## Show this help message
49+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
50+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)