-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
121 lines (86 loc) · 4.39 KB
/
Copy pathMakefile
File metadata and controls
121 lines (86 loc) · 4.39 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
.PHONY: help install lock upgrade sync format format-check lint lint-ci lint-fix lint-loc lint-readme typecheck typecheck-fast typecheck-stop typecheck-fresh test test-fast test-unit test-integration test-cov test-all check ci-local precommit clean dev mcp-serve mcp-serve-http docker-build docker-up docker-down docker-logs
DOCKER_COMPOSE := $(shell if command -v docker >/dev/null 2>&1 && docker compose version >/dev/null 2>&1; then echo "docker compose"; elif command -v docker-compose >/dev/null 2>&1; then echo "docker-compose"; else echo "docker compose"; fi)
.DEFAULT_GOAL := help
help: ## Display this help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
install: ## Install project and development dependencies with uv
uv sync --group dev
sync: install ## Alias for install
lock: ## Resolve and update uv.lock
uv lock
upgrade: ## Upgrade locked dependencies
uv lock --upgrade
format: ## Format Python code
uv run ruff format stringdb_link tests server.py mcp_server.py
format-check: ## Check formatting without writing
uv run ruff format --check stringdb_link tests server.py mcp_server.py
lint: ## Lint Python code
uv run ruff check stringdb_link tests server.py mcp_server.py
lint-ci: ## Lint Python code without modifying files
uv run ruff check stringdb_link tests server.py mcp_server.py --output-format=github
lint-fix: ## Lint and apply safe fixes
uv run ruff check stringdb_link tests server.py mcp_server.py --fix
lint-loc: ## Enforce per-file line budget (see AGENTS.md "File Size Discipline")
uv run python scripts/check_file_size.py
lint-readme: ## Enforce the GeneFoundry README Standard v1
uv run python scripts/check_readme.py
typecheck: ## Type check package
uv run mypy stringdb_link server.py mcp_server.py
typecheck-fast: ## Type check with mypy daemon and fallback
@tmp_log=$$(mktemp); \
if uv run dmypy run -- stringdb_link server.py mcp_server.py >$$tmp_log 2>&1; then \
cat $$tmp_log; \
elif grep -q "Success: no issues found" $$tmp_log; then \
cat $$tmp_log; \
elif grep -Eq "Daemon crashed!|INTERNAL ERROR" $$tmp_log; then \
echo "dmypy crashed; retrying with a fresh daemon..."; \
uv run dmypy stop >/dev/null 2>&1 || true; \
if uv run dmypy run -- stringdb_link server.py mcp_server.py >$$tmp_log 2>&1; then \
cat $$tmp_log; \
else \
cat $$tmp_log; \
echo "Falling back to plain mypy..."; \
uv run dmypy stop >/dev/null 2>&1 || true; \
uv run mypy stringdb_link server.py mcp_server.py; \
fi; \
else \
cat $$tmp_log; \
rm -f $$tmp_log; \
exit 1; \
fi; \
rm -f $$tmp_log
typecheck-stop: ## Stop mypy daemon
uv run dmypy stop
typecheck-fresh: ## Clear mypy cache and run typecheck
rm -rf .mypy_cache
uv run mypy stringdb_link server.py mcp_server.py
test: ## Run tests quickly
uv run pytest tests -q
test-fast: ## Run tests in parallel with pytest-xdist
uv run pytest tests -q -n auto
test-unit: ## Run unit tests in parallel
uv run pytest tests -q -n auto -m "not integration and not slow"
test-integration: ## Run integration tests serially
uv run pytest tests -q -m "integration"
test-cov: ## Run tests with coverage
uv run pytest tests --cov=stringdb_link --cov-report=term-missing --cov-report=html --cov-report=xml
test-all: test-cov ## Alias for full test run with coverage
check: format lint ## Format and lint
ci-local: format-check lint-ci lint-loc lint-readme typecheck-fast test-fast ## Run fast local CI-equivalent checks
precommit: ci-local ## Run checks expected before commit
clean: ## Remove local caches and generated reports
rm -rf .pytest_cache .ruff_cache .mypy_cache htmlcov .coverage coverage.xml
dev: ## Start REST plus MCP development server
uv run stringdb-link server --transport unified --host 127.0.0.1 --port 8000 --reload
mcp-serve: ## Start local stdio MCP server
uv run python mcp_server.py
mcp-serve-http: ## Start hosted MCP endpoint with REST API
uv run stringdb-link server --transport unified --host 0.0.0.0 --port 8000
docker-build: ## Build Docker image
$(DOCKER_COMPOSE) -f docker/docker-compose.yml build
docker-up: ## Start Docker services
$(DOCKER_COMPOSE) -f docker/docker-compose.yml up -d
docker-down: ## Stop Docker services
$(DOCKER_COMPOSE) -f docker/docker-compose.yml down
docker-logs: ## Tail Docker service logs
$(DOCKER_COMPOSE) -f docker/docker-compose.yml logs -f