|
| 1 | +# Colors for pretty output |
| 2 | +BLUE := \033[36m |
| 3 | +BOLD := \033[1m |
| 4 | +RESET := \033[0m |
| 5 | + |
1 | 6 | .DEFAULT_GOAL := help
|
2 | 7 |
|
| 8 | +.PHONY: help verify install fmt test marimo clean |
| 9 | + |
| 10 | +##@ Development Setup |
| 11 | + |
3 | 12 | venv:
|
| 13 | + @printf "$(BLUE)Creating virtual environment...$(RESET)\n" |
4 | 14 | @curl -LsSf https://astral.sh/uv/install.sh | sh
|
5 |
| - @uv venv --python='3.12' |
| 15 | + @uv venv --python 3.12 |
6 | 16 |
|
| 17 | +install: venv ## Install all dependencies using uv |
| 18 | + @printf "$(BLUE)Installing dependencies...$(RESET)\n" |
| 19 | + @uv sync --dev --frozen |
7 | 20 |
|
8 |
| -.PHONY: install |
9 |
| -install: venv ## Install a virtual environment |
10 |
| - @uv pip install --upgrade pip |
11 |
| - @uv sync --all-extras --dev --frozen |
| 21 | +##@ Code Quality |
12 | 22 |
|
13 |
| - |
14 |
| -.PHONY: fmt |
15 |
| -fmt: venv ## Run autoformatting and linting |
| 23 | +fmt: venv ## Run code formatting and linting |
| 24 | + @printf "$(BLUE)Running formatters and linters...$(RESET)\n" |
16 | 25 | @uv pip install pre-commit
|
17 | 26 | @uv run pre-commit install
|
18 | 27 | @uv run pre-commit run --all-files
|
19 | 28 |
|
| 29 | +##@ Testing |
20 | 30 |
|
21 |
| -.PHONY: clean |
22 |
| -clean: ## Clean up caches and build artifacts |
23 |
| - @git clean -X -d -f |
| 31 | +test: install ## Run all tests |
| 32 | + @printf "$(BLUE)Running tests...$(RESET)\n" |
| 33 | + @uv pip install pytest |
| 34 | + @uv run pytest src/tests |
24 | 35 |
|
| 36 | +##@ Cleanup |
25 | 37 |
|
26 |
| -.PHONY: help |
27 |
| -help: ## Display this help screen |
28 |
| - @echo -e "\033[1mAvailable commands:\033[0m" |
29 |
| - @grep -E '^[a-z.A-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}' | sort |
| 38 | +clean: ## Clean generated files and directories |
| 39 | + @printf "$(BLUE)Cleaning project...$(RESET)\n" |
| 40 | + @git clean -d -X -f |
30 | 41 |
|
| 42 | +##@ Marimo & Jupyter |
31 | 43 |
|
32 |
| -.PHONY: marimo |
33 |
| -marimo: install ## Install Marimo |
| 44 | +marimo: install ## Start a Marimo server |
| 45 | + @printf "$(BLUE)Start Marimo server...$(RESET)\n" |
34 | 46 | @uv pip install marimo
|
35 | 47 | @uv run marimo edit book/marimo
|
36 | 48 |
|
| 49 | +##@ Help |
| 50 | + |
| 51 | +help: ## Display this help message |
| 52 | + @printf "$(BOLD)Usage:$(RESET)\n" |
| 53 | + @printf " make $(BLUE)<target>$(RESET)\n\n" |
| 54 | + @printf "$(BOLD)Targets:$(RESET)\n" |
| 55 | + @awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " $(BLUE)%-15s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(BOLD)%s$(RESET)\n", substr($$0, 5) }' $(MAKEFILE_LIST) |
37 | 56 |
|
38 |
| -.PHONY: test |
39 |
| -test: install ## Run pytests |
40 |
| - @uv pip install pytest |
41 |
| - @uv run pytest src/tests |
|
0 commit comments