-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (107 loc) · 3.58 KB
/
Makefile
File metadata and controls
157 lines (107 loc) · 3.58 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 test test-cov lint format clean build docs pre-commit cpp-build
# Default target
.DEFAULT_GOAL := help
# Colors for output
BLUE := \033[0;34m
GREEN := \033[0;32m
RED := \033[0;31m
NC := \033[0m # No Color
help: ## Show this help message
@echo "$(BLUE)EdgeSAM Development Makefile$(NC)"
@echo ""
@echo "$(GREEN)Available targets:$(NC)"
@awk 'BEGIN {FS = ":.*##"; printf ""} /^[a-zA-Z_-]+:.*?##/ { printf " $(BLUE)%-20s$(NC) %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# ===== INSTALLATION =====
install: ## Install package for production
pip install -e .
install-dev: ## Install package with development dependencies
pip install -e ".[dev]"
pre-commit install
install-all: ## Install package with all optional dependencies
pip install -e ".[all]"
pre-commit install
# ===== TESTING =====
test: ## Run tests
hatch run test:test
test-cov: ## Run tests with coverage
hatch run test:test-cov
test-all: ## Run tests on all Python versions
hatch run test:test
benchmark: ## Run benchmark tests
pytest tests/ -m benchmark --benchmark-only
# ===== LINTING & FORMATTING =====
lint: ## Run all linters
hatch run lint:all
lint-fix: ## Run linters with auto-fix
hatch run lint:fmt
format: lint-fix ## Format code (alias for lint-fix)
ruff: ## Run ruff linter
ruff check .
ruff-fix: ## Run ruff with auto-fix
ruff check --fix .
black: ## Run black formatter
black .
mypy: ## Run mypy type checker
hatch run lint:typing
# ===== BUILDING =====
build: ## Build Python package
hatch build
build-cpp: ## Build C++ project
chmod +x build.sh
./build.sh
clean: ## Clean build artifacts
rm -rf build dist *.egg-info
rm -rf .hatch .pytest_cache .mypy_cache .ruff_cache
rm -rf htmlcov .coverage coverage.xml
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
# ===== DOCUMENTATION =====
docs: ## Build documentation
cd docs && mkdocs build
docs-serve: ## Serve documentation locally
cd docs && mkdocs serve
# ===== PRE-COMMIT =====
pre-commit: ## Run pre-commit on all files
pre-commit run --all-files
pre-commit-update: ## Update pre-commit hooks
pre-commit autoupdate
# ===== COVERAGE =====
coverage: test-cov ## Generate coverage report
hatch run cov-report
coverage-html: test-cov ## Generate HTML coverage report
coverage html
@echo "$(GREEN)Coverage report generated at htmlcov/index.html$(NC)"
# ===== SECURITY =====
security: ## Run security checks
bandit -r edgesam_py -c pyproject.toml
safety check
# ===== DEVELOPMENT =====
dev: install-dev pre-commit ## Setup development environment
@echo "$(GREEN)Development environment ready!$(NC)"
shell: ## Start hatch shell
hatch shell
version: ## Show version
@python -c "from edgesam_py import __version__; print(__version__)"
# ===== CI/CD =====
ci: lint test build ## Run CI checks locally
@echo "$(GREEN)All CI checks passed!$(NC)"
publish-test: build ## Publish to TestPyPI
hatch publish -r test
publish: build ## Publish to PyPI
hatch publish
# ===== DOCKER =====
docker-build: ## Build Docker image
docker build -t edgesam:latest .
docker-run: ## Run Docker container
docker run -it --rm edgesam:latest
# ===== UTILITIES =====
tree: ## Show project structure
@tree -I '__pycache__|*.pyc|*.egg-info|.git|.hatch|.pytest_cache|.mypy_cache|.ruff_cache|htmlcov|dist|build'
check: ## Quick check (lint + test)
@echo "$(BLUE)Running quick checks...$(NC)"
@make lint
@make test
@echo "$(GREEN)All checks passed!$(NC)"
all: clean install-dev lint test build ## Run all development tasks
@echo "$(GREEN)All tasks completed successfully!$(NC)"