-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (76 loc) · 2.59 KB
/
Copy pathMakefile
File metadata and controls
89 lines (76 loc) · 2.59 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
.PHONY: help venv install dev test format lint lintmd typecheck check clean run
# Variables
PYTHON := python3.13
VENV := .venv
UV := uv
VENV_PYTHON := $(VENV)/bin/python
VENV_UV := $(VENV)/bin/uv
# Default target
help:
@echo "Available targets:"
@echo " venv - Create virtual environment"
@echo " install - Install production dependencies"
@echo " dev - Install development dependencies and pre-commit hooks"
@echo " test - Run tests with coverage"
@echo " format - Format code with black"
@echo " lint - Lint code with flake8"
@echo " lintmd - Lint markdown files with pymarkdownlnt"
@echo " typecheck - Type check with pyright"
@echo " check - Run all checks (format, lint, lintmd, typecheck, test)"
@echo " run - Run the devrelay proxy"
@echo " clean - Remove virtual environment and cache files"
# Create virtual environment
venv:
@if [ ! -d "$(VENV)" ]; then \
echo "Creating virtual environment..."; \
$(UV) venv $(VENV) --python $(PYTHON); \
else \
echo "Virtual environment already exists"; \
fi
# Install production dependencies
install: venv
@echo "Installing production dependencies..."
@$(UV) pip install --python $(VENV_PYTHON) -e .
# Install development dependencies
dev: venv
@echo "Installing development dependencies..."
@$(UV) pip install --python $(VENV_PYTHON) -e ".[dev]"
@echo "Installing pre-commit hooks..."
@$(VENV)/bin/pre-commit install
# Run tests with coverage
test: dev
@echo "Running tests with coverage..."
@$(VENV)/bin/pytest
# Format code with black
format: dev
@echo "Formatting code with black..."
@$(VENV)/bin/black devrelay tests
# Lint code with flake8
lint: dev
@echo "Linting code with flake8..."
@$(VENV)/bin/flake8 devrelay tests --max-line-length=120 --extend-ignore=E203,W503
# Lint markdown files with pymarkdownlnt
lintmd: dev
@echo "Linting markdown files with pymarkdownlnt..."
@$(VENV)/bin/pymarkdown --config .pymarkdown.json scan .
# Type check with pyright
typecheck: dev
@echo "Type checking with pyright..."
@$(VENV)/bin/pyright
# Run all checks
check: format lint lintmd typecheck test
@echo "All checks passed!"
# Run the devrelay proxy
run: install
@$(VENV)/bin/devrelay
# Clean up
clean:
@echo "Cleaning up..."
@rm -rf $(VENV)
@rm -rf __pycache__ .pytest_cache .coverage htmlcov
@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
@find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@echo "Clean complete"