-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (50 loc) · 2.08 KB
/
Makefile
File metadata and controls
60 lines (50 loc) · 2.08 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
.PHONY: proto proto-check install install-pip test test-unit test-integration lint clean
PROTO_SRC := proto
PROTO_OUT := coordinode/coordinode/_proto
PYTHON ?= python3
# Generate gRPC stubs from proto submodule into coordinode/_proto/
proto:
@echo "==> Generating proto stubs..."
@mkdir -p $(PROTO_OUT)
$(PYTHON) -m grpc_tools.protoc \
-I$(PROTO_SRC) \
--python_out=$(PROTO_OUT) \
--grpc_python_out=$(PROTO_OUT) \
--pyi_out=$(PROTO_OUT) \
$$(find $(PROTO_SRC) -name '*.proto')
@# Add __init__.py to every generated package directory
@find $(PROTO_OUT) -type d -exec touch {}/__init__.py \;
@# Fix absolute imports in all generated pb2 files (grpc_tools generates absolute paths)
@# sed -i.bak is portable: macOS needs empty-string backup arg, GNU sed uses -i alone;
@# using .bak suffix works on both, then we clean up the backup files.
@find $(PROTO_OUT) -name '*.py' -exec sed -i.bak \
's/from coordinode\.v1\./from coordinode._proto.coordinode.v1./g' {} \;
@find $(PROTO_OUT) -name '*.py.bak' -delete
@echo "==> Proto generation complete: $(PROTO_OUT)/"
proto-check:
@test -f $(PROTO_OUT)/coordinode/v1/query/cypher_pb2.py || \
(echo "ERROR: Proto stubs not generated. Run: make proto" && exit 1)
# Install using uv (recommended for contributors).
# uv sync runs first — it installs grpcio-tools which proto generation requires.
install:
uv sync
$(MAKE) proto
# Install using pip (alternative — works without uv)
install-pip:
pip install -e "coordinode[dev]"
pip install -e langchain-coordinode/
pip install -e llama-index-coordinode/
$(MAKE) proto
test: proto-check test-unit
test-unit:
pytest tests/unit/ -v
test-integration:
pytest tests/integration/ -v --timeout=30
lint:
ruff check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
ruff format --check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
clean:
rm -rf $(PROTO_OUT)
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name dist -exec rm -rf {} + 2>/dev/null || true