Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (99 loc) · 4.7 KB
/
Copy pathMakefile
File metadata and controls
132 lines (99 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
SHELL := /bin/bash
COLOR_RESET=\033[0m
COLOR_CYAN=\033[1;36m
COLOR_GREEN=\033[1;32m
SRC_DIR = src
TEST_DIR = tests
PACKAGE = droid_dash
VENV = .venv/bin
.PHONY: help install create-venv install-deps clean test coverage coverage-show format lint lint-stats fix type ty bandit changelog docs docs-serve build run nox nox-list pre-commit pre-commit-install bump-patch bump-minor bump-major
.DEFAULT_GOAL := help
.SILENT:
help: ## Show all Makefile targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'
install: create-venv install-deps ## Create virtual environment and install dependencies.
@echo -e "$(COLOR_GREEN)All done!$(COLOR_RESET)"
create-venv: ## Create a virtual environment using uv.
@echo -e "$(COLOR_CYAN)Creating virtual environment...$(COLOR_RESET)"
uv venv --python 3.11
uv python pin 3.11
install-deps: ## Install dependencies (including dev).
@echo -e "$(COLOR_CYAN)Installing dependencies...$(COLOR_RESET)"
uv sync --group dev --group docs
clean: ## Clean up pycache, pyc files, and build artifacts.
@echo -e "$(COLOR_CYAN)Cleaning up...$(COLOR_RESET)"
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -exec rm -rf {} +
rm -rf dist/ build/ *.egg-info/ .pytest_cache/ .mypy_cache/ .ruff_cache/ htmlcov/ site/
test: ## Run tests with pytest.
@echo -e "$(COLOR_CYAN)Running tests...$(COLOR_RESET)"
PYTHONPATH=$(SRC_DIR) $(VENV)/pytest $(TEST_DIR)/ -v
coverage: ## Run tests with coverage report.
@echo -e "$(COLOR_CYAN)Running tests with coverage...$(COLOR_RESET)"
PYTHONPATH=$(SRC_DIR) $(VENV)/pytest --cov=$(PACKAGE) --cov-report=html --cov-report=term-missing $(TEST_DIR)/
coverage-show: ## Open coverage report in browser.
@echo -e "$(COLOR_CYAN)Opening coverage report...$(COLOR_RESET)"
@if [ "$$(uname)" = "Darwin" ]; then open htmlcov/index.html; \
elif [ "$$(uname)" = "Linux" ]; then xdg-open htmlcov/index.html; fi
format: ## Format code with ruff.
@echo -e "$(COLOR_CYAN)Formatting code...$(COLOR_RESET)"
$(VENV)/ruff format $(SRC_DIR) $(TEST_DIR)
$(VENV)/ruff check $(SRC_DIR) $(TEST_DIR) --fix --unsafe-fixes
lint: ## Check code style with ruff.
@echo -e "$(COLOR_CYAN)Linting code...$(COLOR_RESET)"
$(VENV)/ruff check $(SRC_DIR) $(TEST_DIR)
lint-stats: ## Show ruff violation statistics.
@echo -e "$(COLOR_CYAN)Ruff statistics...$(COLOR_RESET)"
$(VENV)/ruff check $(SRC_DIR) $(TEST_DIR) --statistics
fix: ## Auto-fix ruff issues.
@echo -e "$(COLOR_CYAN)Fixing code issues...$(COLOR_RESET)"
$(VENV)/ruff check $(SRC_DIR) $(TEST_DIR) --fix
type: ## Run type checker (mypy).
@echo -e "$(COLOR_CYAN)Type checking...$(COLOR_RESET)"
$(VENV)/mypy $(SRC_DIR)/$(PACKAGE) --ignore-missing-imports
ty: ## Run ty static type checker.
@echo -e "$(COLOR_CYAN)Running ty type checker...$(COLOR_RESET)"
$(VENV)/ty check $(SRC_DIR)
bandit: ## Run security linter.
@echo -e "$(COLOR_CYAN)Running bandit...$(COLOR_RESET)"
$(VENV)/bandit -r $(SRC_DIR) -ll -ii
docs: ## Build documentation with mkdocs.
@echo -e "$(COLOR_CYAN)Building documentation...$(COLOR_RESET)"
uv sync --group docs
$(VENV)/mkdocs build
docs-serve: ## Serve documentation locally.
@echo -e "$(COLOR_CYAN)Serving documentation at http://127.0.0.1:8000...$(COLOR_RESET)"
uv sync --group docs
$(VENV)/mkdocs serve
commit: ## Interactive conventional commit.
@echo -e "$(COLOR_CYAN)Creating conventional commit...$(COLOR_RESET)"
$(VENV)/cz commit
build: ## Build the package.
@echo -e "$(COLOR_CYAN)Building package...$(COLOR_RESET)"
uv build
run: ## Run the TUI dashboard.
@echo -e "$(COLOR_CYAN)Starting dashboard...$(COLOR_RESET)"
PYTHONPATH=$(SRC_DIR) $(VENV)/python -m $(PACKAGE).cli
changelog: ## Generate changelog using git-cliff.
git-cliff -o CHANGELOG.md
nox: ## Run nox sessions (multi-version testing).
@echo -e "$(COLOR_CYAN)Running nox sessions...$(COLOR_RESET)"
$(VENV)/nox
nox-list: ## List available nox sessions.
@echo -e "$(COLOR_CYAN)Available nox sessions:$(COLOR_RESET)"
$(VENV)/nox --list
pre-commit: ## Run pre-commit hooks on all files.
@echo -e "$(COLOR_CYAN)Running pre-commit hooks...$(COLOR_RESET)"
$(VENV)/pre-commit run --all-files
pre-commit-install: ## Install pre-commit hooks.
@echo -e "$(COLOR_CYAN)Installing pre-commit hooks...$(COLOR_RESET)"
$(VENV)/pre-commit install
bump-patch: ## Bump patch version (0.0.X).
@echo -e "$(COLOR_CYAN)Bumping patch version...$(COLOR_RESET)"
$(VENV)/bump-my-version bump patch
bump-minor: ## Bump minor version (0.X.0).
@echo -e "$(COLOR_CYAN)Bumping minor version...$(COLOR_RESET)"
$(VENV)/bump-my-version bump minor
bump-major: ## Bump major version (X.0.0).
@echo -e "$(COLOR_CYAN)Bumping major version...$(COLOR_RESET)"
$(VENV)/bump-my-version bump major