-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
251 lines (203 loc) Β· 7.89 KB
/
Makefile
File metadata and controls
251 lines (203 loc) Β· 7.89 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Codomyrmex Development Makefile
# Common development tasks and workflows
.PHONY: help dev install setup submodules test lint format type-check security clean docs serve build deploy benchmark benchmark-mcp test-obsidian test-fast verify-release
# Hypothesis loads its pytest plugin (and may bind NumPy RNG) before any conftest runs.
# Export for all subprocesses so `uv run pytest` sees it even when not using a shell wrapper.
export HYPOTHESIS_NO_NPY := 1
# Default target
help:
@echo "Codomyrmex Development Makefile"
@echo "=============================="
@echo ""
@echo "Available targets:"
@echo " dev - Install all dependency groups"
@echo " install - Install dependencies using uv"
@echo " submodules - Initialize git submodules and install their deps"
@echo " setup - Set up complete development environment (install + submodules)"
@echo " test - Run all tests with coverage + 40% gate"
@echo " test-unit - Run unit tests only"
@echo " test-integration - Run integration tests only"
@echo " test-coverage - Run tests with coverage report"
@echo " test-coverage-html - Open HTML coverage report in browser"
@echo " test-obsidian - Run Obsidian module tests only"
@echo " test-fast - Run tests with minimal addopts (no verbose/timeout from ini)"
@echo " lint - Run code linting with ruff"
@echo " format - Format code with ruff"
@echo " type-check - Run type checking with ty"
@echo " security - Run security scanning"
@echo " docs - Generate and check documentation"
@echo " serve-docs - Serve documentation locally"
@echo " clean - Clean build artifacts and caches"
@echo " analyze - Run project analysis"
@echo " check-deps - Check and validate dependencies"
@echo " check-dependencies - Check module dependency hierarchy"
@echo " ci - Run full CI pipeline"
@echo " verify-release - lint + type-check + full tests with 40% coverage gate"
@echo ""
# Installation and setup
install:
@echo "Installing Codomyrmex with uv..."
uv sync
dev:
@echo "Installing all dependency groups..."
uv sync --all-groups
submodules:
@echo "Initializing and setting up git submodules..."
@bash scripts/setup_submodules.sh
setup: install submodules
@echo "Development environment (including submodules) ready!"
# Testing
test:
@echo "Running all tests..."
uv run pytest src/codomyrmex/tests/ -v --tb=short --cov=src/codomyrmex --cov-report=term-missing --cov-report=html:htmlcov --cov-report=json:coverage.json --cov-fail-under=40
test-unit:
@echo "Running unit tests..."
uv run pytest src/codomyrmex/tests/unit/ -v --tb=short -m unit --cov=src/codomyrmex --cov-report=term-missing --cov-report=json:coverage.json --cov-fail-under=40
test-integration:
@echo "Running integration tests..."
uv run pytest src/codomyrmex/tests/integration/ -v --tb=short -m integration
test-obsidian:
@echo "Running Obsidian module tests..."
uv run pytest src/codomyrmex/tests/unit/agentic_memory/obsidian/ -v --tb=short --override-ini="addopts="
test-fast:
@echo "Running tests with minimal addopts (override ini)..."
uv run pytest src/codomyrmex/tests/ -q --no-header --override-ini="addopts="
test-coverage:
@echo "Running tests with coverage report..."
uv run pytest src/codomyrmex/tests/ -v --tb=short --cov=src/codomyrmex --cov-report=term-missing --cov-report=html:htmlcov --cov-report=json:coverage.json --cov-fail-under=40
@echo "Coverage report generated: coverage.json and htmlcov/"
test-coverage-html:
@echo "Opening HTML coverage report..."
@if [ -d "htmlcov" ]; then \
python3 -m http.server 8000 --directory htmlcov & \
echo "Coverage report available at http://localhost:8000"; \
else \
echo "No coverage report found. Run 'make test-coverage' first."; \
fi
verify-release: lint type-check test
@echo "verify-release: all checks passed."
# Code quality
lint:
@echo "Running linting with ruff..."
uv run ruff check .
format:
@echo "Formatting code with ruff..."
uv run ruff format .
type-check:
@echo "Running type checking with ty..."
uv run ty check src/
security:
@echo "Running security scanning..."
uv run python -m bandit -r src/codomyrmex/
@echo "Checking for vulnerabilities..."
uv run python -m pip-audit
# Performance Benchmarks
benchmark-mcp:
@echo "Running MCP performance benchmarks..."
uv run python -m pytest src/codomyrmex/tests/performance/test_mcp_load.py -v --no-cov --no-header
@echo "Running MCP benchmark suite..."
uv run python -m pytest src/codomyrmex/tests/performance/test_mcp_performance.py -v --no-cov --no-header --benchmark-only 2>/dev/null || \
uv run python -m pytest src/codomyrmex/tests/performance/test_mcp_performance.py -v --no-cov --no-header
benchmark: benchmark-mcp
@echo "All benchmarks completed."
# Documentation
docs: docs-check docs-generate
docs-check:
@echo "Checking documentation status..."
uv run python scripts/documentation/check_docs_status.py
docs-generate:
@echo "Generating missing documentation..."
uv run python scripts/documentation/generate_missing_readmes.py
serve-docs:
@echo "Serving documentation locally..."
@echo "Note: This requires documentation website setup"
@echo "See docs/development/documentation.md for setup instructions"
# Analysis and maintenance
analyze:
@echo "Running project analysis..."
uv run python -m codomyrmex.tools.analyze_project
check-deps:
@echo "Checking dependencies..."
uv run python -m codomyrmex.tools.dependency_checker
check-dependencies:
@echo "Checking module dependency hierarchy..."
uv run python -m codomyrmex.tools.dependency_analyzer
ci: lint type-check security test docs-check
@echo "CI pipeline completed successfully!"
# Development server
dev:
@echo "Starting development server..."
@echo "Note: This requires additional setup for web server"
@echo "See docs/development/environment-setup.md"
# Cleanup
clean:
@echo "Cleaning build artifacts and caches..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf htmlcov/
rm -rf .coverage
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .ruff_cache/
rm -rf .ty/
find . -type d -name __pycache__ -delete
find . -type f -name "*.pyc" -delete
@echo "Cleanup complete!"
# Advanced targets
build: clean
@echo "Building package..."
uv build
deploy: build
@echo "Deploying package..."
@echo "Note: Configure deployment target in pyproject.toml"
uv publish
# Environment management
env-info:
@echo "Environment information:"
@echo "Python version: $$(python --version)"
@echo "Python path: $$(which python)"
@echo "Virtual environment: $$(python -c 'import sys; print(\"Yes\" if hasattr(sys, \"real_prefix\") or (hasattr(sys, \"base_prefix\") and sys.base_prefix != sys.prefix) else \"No\")')"
@echo "UV available: $$(which uv || echo 'No')"
@echo "Git available: $$(which git || echo 'No')"
@echo "Docker available: $$(which docker || echo 'No')"
# Quick commands
quick-test: test-unit
quick-lint: lint
quick-format: format
quick-check: lint format type-check
# Development workflow
dev-workflow: format lint type-check test-unit
@echo "Development workflow completed!"
# Production workflow
prod-workflow: ci security analyze
@echo "Production workflow completed!"
# Update all
update: install clean
@echo "Updating all dependencies and cleaning cache..."
uv sync --upgrade
# Docker targets (if needed)
docker-build:
@echo "Building Docker image..."
docker build -t codomyrmex:latest .
docker-run:
@echo "Running Codomyrmex in Docker..."
docker run -p 8000:8000 codomyrmex:latest
# Git workflow helpers
git-status:
@echo "Running ruff on all files..."
uv run ruff check .
git-clean:
git clean -fd
git-reset:
git reset --hard HEAD
# Release helpers
release-patch:
@echo "Creating patch release..."
@echo "Run: uv run python -m bump2version patch"
release-minor:
@echo "Creating minor release..."
@echo "Run: uv run python -m bump2version minor"
release-major:
@echo "Creating major release..."
@echo "Run: uv run python -m bump2version major"