-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (128 loc) · 4.71 KB
/
Makefile
File metadata and controls
157 lines (128 loc) · 4.71 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.PHONY: help install install-dev install-test uninstall test test-verbose lint format format-check clean build build-docs serve-docs version-update all translate coverage-report
# Default target
help: ## Show this help message
@echo "FastAPI-fastkit Development Commands"
@echo "===================================="
@echo ""
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Installation commands
install: ## Install the package in production mode
pip install .
install-dev: ## Install the package with development dependencies
pip install -e ".[dev]"
install-test: ## Install the package for testing purposes
pip uninstall FastAPI-fastkit -y || true
pip install -e .
uninstall: ## Uninstall the package
pip uninstall FastAPI-fastkit -y
# Testing commands
test: ## Run all tests
pytest
test-verbose: ## Run tests with verbose output
pytest -v -s
test-coverage: ## Run tests with coverage report
./scripts/coverage.sh
coverage: ## Alias for test-coverage
$(MAKE) test-coverage
# Template inspection commands
inspect-templates: ## Run template inspection on all templates
python scripts/inspect-templates.py
inspect-templates-verbose: ## Run template inspection with verbose output
python scripts/inspect-templates.py --verbose
inspect-template: ## Inspect specific template(s) - Usage: make inspect-template TEMPLATES="template-name"
@if [ -z "$(TEMPLATES)" ]; then \
echo "Usage: make inspect-template TEMPLATES=\"template-name1,template-name2\""; \
echo "Example: make inspect-template TEMPLATES=\"fastapi-default,fastapi-async-crud\""; \
exit 1; \
fi
python scripts/inspect-templates.py --templates "$(TEMPLATES)"
# Code quality commands
lint: ## Run all linting checks
@echo "Running isort check..."
isort --sp pyproject.toml --check .
@echo "Running black check..."
black --config pyproject.toml --check .
@echo "Running mypy check..."
mypy --config-file pyproject.toml src
format: ## Format code using black and isort
@echo "Running isort..."
isort --sp pyproject.toml .
@echo "Running black..."
black --config pyproject.toml .
format-check: ## Check code formatting without making changes
@echo "Checking isort..."
isort --sp pyproject.toml --check-only --diff .
@echo "Checking black..."
black --config pyproject.toml --check --diff .
# Build commands
clean: ## Clean build artifacts and cache files
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf __pycache__/
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name ".coverage" -delete
rm -rf htmlcov/
rm -rf coverage.xml
build: clean ## Build the package
python -m build
build-wheel: clean ## Build wheel package only
python -m build --wheel
build-sdist: clean ## Build source distribution only
python -m build --sdist
# Documentation commands
build-docs: ## Build documentation
mkdocs build
serve-docs: ## Serve documentation locally
mkdocs serve
# Development workflow commands
dev-setup: ## Set up development environment from scratch
@echo "Setting up development environment..."
pip install --upgrade pip
pip install -e ".[dev]"
pip install -e ".[docs]" || pip install -r requirements-docs.txt
pre-commit install
@echo "Development environment setup complete!"
dev-check: ## Run all development checks (format, lint, test)
@echo "Running development checks..."
$(MAKE) format-check
$(MAKE) lint
$(MAKE) test
@echo "All checks passed!"
dev-fix: ## Fix formatting and run tests
@echo "Fixing code formatting..."
$(MAKE) format
@echo "Running tests..."
$(MAKE) test
@echo "Development fixes complete!"
# Quick commands for contributors
quick-install: ## Quick install for testing (uninstall + install)
$(MAKE) install-test
quick-test: ## Quick test after code changes
$(MAKE) format
$(MAKE) test
all: ## Run complete development workflow
$(MAKE) clean
$(MAKE) dev-setup
$(MAKE) dev-check
$(MAKE) build
# Translation commands
translate: ## Translate documentation - Usage: make translate LANG=ko PROVIDER=github MODEL=gpt-4o-mini
@echo "Starting translation..."
@CMD="python scripts/translate.py"; \
if [ -n "$(LANG)" ]; then CMD="$$CMD --target-lang $(LANG)"; fi; \
if [ -n "$(PROVIDER)" ]; then CMD="$$CMD --api-provider $(PROVIDER)"; fi; \
if [ -n "$(MODEL)" ]; then CMD="$$CMD --model $(MODEL)"; fi; \
echo "Running: $$CMD"; \
$$CMD
# Coverage report commands
coverage-report: ## Generate detailed coverage report - Usage: make coverage-report FORMAT=html
@if [ -z "$(FORMAT)" ]; then \
./scripts/coverage-report.sh; \
else \
./scripts/coverage-report.sh -f "$(FORMAT)"; \
fi