-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (88 loc) · 4.46 KB
/
Makefile
File metadata and controls
111 lines (88 loc) · 4.46 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
# Makefile for py_roadmap Flask application
# Variables
VENV = .venv
PYTHON = $(VENV)/bin/python
PIP = $(VENV)/bin/pip
FLASK = $(VENV)/bin/flask
UV = uv
# Colors for output
RED = \033[0;31m
GREEN = \033[0;32m
YELLOW = \033[0;33m
BLUE = \033[0;34m
NC = \033[0m # No Color
.PHONY: help install dev start test lint format clean build
help: ## Show this help message
@echo "$(BLUE)Available commands:$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-15s$(NC) %s\n", $$1, $$2}'
install: ## Install dependencies
@echo "$(YELLOW)Installing dependencies...$(NC)"
$(UV) sync
@echo "$(GREEN)Dependencies installed successfully!$(NC)"
dev-deps: ## Install development dependencies
@echo "$(YELLOW)Installing development dependencies...$(NC)"
$(UV) sync
@echo "$(GREEN)Development dependencies installed!$(NC)"
dev: ## Start development server with auto-reload
@echo "$(YELLOW)Starting development server...$(NC)"
@echo "$(BLUE)Server will auto-reload on Python file changes$(NC)"
@source $(VENV)/bin/activate && FLASK_APP=run.py FLASK_ENV=development $(PYTHON) run.py
start: dev ## Alias for dev command
watch: ## Start development server with enhanced file watching (requires watchdog)
@echo "$(YELLOW)Starting development server with enhanced file watching...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) scripts/watch.py
test: ## Run tests
@echo "$(YELLOW)Running tests...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -m pytest
test-verbose: ## Run tests with verbose output
@echo "$(YELLOW)Running tests with verbose output...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -m pytest -v
lint: ## Run linting (flake8)
@echo "$(YELLOW)Running linting...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -m flake8 app/ config/ run.py
format: ## Format code with black
@echo "$(YELLOW)Formatting code...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -m black app/ config/ run.py
@echo "$(GREEN)Code formatted successfully!$(NC)"
type-check: ## Run type checking with mypy
@echo "$(YELLOW)Running type checking...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -m mypy app/ config/ run.py
check: lint type-check ## Run all code quality checks
tailwind-watch: ## Watch and compile Tailwind CSS
@echo "$(YELLOW)Starting Tailwind CSS watcher...$(NC)"
npx tailwindcss -i ./app/static/css/input.css -o ./app/static/css/tailwind.css --watch
build-css: ## Build Tailwind CSS for production
@echo "$(YELLOW)Building Tailwind CSS for production...$(NC)"
npx tailwindcss -i ./app/static/css/input.css -o ./app/static/css/tailwind.css --minify
shell: ## Open Flask shell
@echo "$(YELLOW)Opening Flask shell...$(NC)"
@source $(VENV)/bin/activate && FLASK_APP=run.py $(FLASK) shell
db-init: ## Initialize database
@echo "$(YELLOW)Initializing database...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.create_all(); print('Database initialized!')"
db-reset: ## Reset database (drop and recreate all tables)
@echo "$(YELLOW)Resetting database...$(NC)"
@source $(VENV)/bin/activate && $(PYTHON) -c "from app import create_app, db; app = create_app(); app.app_context().push(); db.drop_all(); db.create_all(); print('Database reset complete!')"
clean: ## Clean up cache files
@echo "$(YELLOW)Cleaning up cache files...$(NC)"
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 "*.pyd" -delete
find . -type f -name ".coverage" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@echo "$(GREEN)Cache files cleaned!$(NC)"
setup: install dev-deps db-init ## Complete project setup
@echo "$(GREEN)Project setup complete!$(NC)"
@echo "$(BLUE)Run 'make dev' to start the development server$(NC)"
info: ## Show project information
@echo "$(BLUE)Project Information:$(NC)"
@echo " Name: py_roadmap"
@echo " Python: $(shell source $(VENV)/bin/activate && python --version)"
@echo " Flask: $(shell source $(VENV)/bin/activate && python -c 'import flask; print(flask.__version__)' 2>/dev/null || echo 'Not installed')"
@echo " Virtual Environment: $(VENV)"
@echo ""
@echo "$(BLUE)Quick Start:$(NC)"
@echo " 1. Run '$(GREEN)make setup$(NC)' for initial setup"
@echo " 2. Run '$(GREEN)make dev$(NC)' to start development server"
@echo " 3. Run '$(GREEN)make tailwind-watch$(NC)' in another terminal for CSS compilation"