|
1 | | -.PHONY: init lint check_lint format check_format test html cleandocs run_notebooks uml |
| 1 | +################################################################################# |
| 2 | +# GLOBALS # |
| 3 | +################################################################################# |
2 | 4 |
|
3 | 5 | PACKAGE_DIR = pymc_marketing |
4 | 6 |
|
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 |
6 | 14 | python3 -m pip install -e . |
7 | 15 |
|
8 | | -lint: |
| 16 | +lint: ## Install linting dependencies and run linter (ruff and mypy) |
9 | 17 | pip install .[lint] |
10 | 18 | ruff check $(PACKAGE_DIR) --fix |
11 | 19 | mypy . |
12 | 20 |
|
13 | | -check_lint: |
| 21 | +check_lint: ## Install linting dependencies and check linting (ruff and mypy) |
14 | 22 | pip install .[lint] |
15 | 23 | ruff check $(PACKAGE_DIR) |
16 | 24 | mypy . |
17 | 25 |
|
18 | | -format: |
| 26 | +format: ## Install linting dependencies and format code (ruff) |
19 | 27 | pip install .[lint] |
20 | 28 | ruff format $(PACKAGE_DIR) |
21 | 29 |
|
22 | | -check_format: |
| 30 | +check_format: ## Install linting dependencies and check code formatting (ruff) |
23 | 31 | pip install .[lint] |
24 | 32 | ruff format --check $(PACKAGE_DIR) |
25 | 33 |
|
26 | | -test: |
| 34 | +test: ## Install test dependencies and run tests |
27 | 35 | pip install .[test] |
28 | 36 | pytest |
29 | 37 |
|
30 | | -html: |
| 38 | +html: ## Install documentation dependencies and build HTML docs |
31 | 39 | pip install .[docs] |
32 | 40 | sphinx-build docs/source docs/build -b html |
33 | 41 |
|
34 | | -cleandocs: |
| 42 | +cleandocs: ## Clean the documentation build directories |
35 | 43 | rm -r "docs/build" "docs/jupyter_execute" "docs/source/api/generated" |
36 | 44 |
|
37 | | -run_notebooks: |
| 45 | +run_notebooks: ## Run Jupyter notebooks |
38 | 46 | python scripts/run_notebooks/runner.py |
39 | 47 |
|
40 | | -uml: |
| 48 | +uml: ## Install documentation dependencies and generate UML diagrams |
41 | 49 | pip install .[docs] |
42 | 50 | pyreverse pymc_marketing/mmm -d docs/source/uml -f 'ALL' -o png -p mmm |
43 | 51 | 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