Skip to content

Commit ff4eef1

Browse files
chore(Makefile): Adding a self-documenting command and light command documentation (#910)
Co-authored-by: Juan Orduz <[email protected]>
1 parent 39f2336 commit ff4eef1

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,43 +1,62 @@
1-
.PHONY: init lint check_lint format check_format test html cleandocs run_notebooks uml
1+
#################################################################################
2+
# GLOBALS #
3+
#################################################################################
24

35
PACKAGE_DIR = pymc_marketing
46

5-
init:
7+
#################################################################################
8+
# COMMANDS #
9+
#################################################################################
10+
11+
.PHONY: init lint check_lint format check_format test html cleandocs run_notebooks uml help
12+
13+
init: ## Install the package in editable mode
614
python3 -m pip install -e .
715

8-
lint:
16+
lint: ## Install linting dependencies and run linter (ruff and mypy)
917
pip install .[lint]
1018
ruff check $(PACKAGE_DIR) --fix
1119
mypy .
1220

13-
check_lint:
21+
check_lint: ## Install linting dependencies and check linting (ruff and mypy)
1422
pip install .[lint]
1523
ruff check $(PACKAGE_DIR)
1624
mypy .
1725

18-
format:
26+
format: ## Install linting dependencies and format code (ruff)
1927
pip install .[lint]
2028
ruff format $(PACKAGE_DIR)
2129

22-
check_format:
30+
check_format: ## Install linting dependencies and check code formatting (ruff)
2331
pip install .[lint]
2432
ruff format --check $(PACKAGE_DIR)
2533

26-
test:
34+
test: ## Install test dependencies and run tests
2735
pip install .[test]
2836
pytest
2937

30-
html:
38+
html: ## Install documentation dependencies and build HTML docs
3139
pip install .[docs]
3240
sphinx-build docs/source docs/build -b html
3341

34-
cleandocs:
42+
cleandocs: ## Clean the documentation build directories
3543
rm -r "docs/build" "docs/jupyter_execute" "docs/source/api/generated"
3644

37-
run_notebooks:
45+
run_notebooks: ## Run Jupyter notebooks
3846
python scripts/run_notebooks/runner.py
3947

40-
uml:
48+
uml: ## Install documentation dependencies and generate UML diagrams
4149
pip install .[docs]
4250
pyreverse pymc_marketing/mmm -d docs/source/uml -f 'ALL' -o png -p mmm
4351
pyreverse pymc_marketing/clv -d docs/source/uml -f 'ALL' -o png -p clv
52+
53+
54+
#################################################################################
55+
# Self Documenting Commands #
56+
#################################################################################
57+
58+
.DEFAULT_GOAL := help
59+
60+
help: ## Show this help message
61+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
62+
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)