Skip to content

Commit 2462cb9

Browse files
authored
Merge pull request #2 from structured-world/fix/#1-sdk-api-correctness
fix: SDK API correctness — constructor, cypher result, VectorResult fields
2 parents a95c513 + 27e92f3 commit 2462cb9

27 files changed

Lines changed: 4109 additions & 356 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,40 @@ jobs:
1010
name: Lint
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1414

15-
- uses: actions/setup-python@v5
15+
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
1616
with:
1717
python-version: "3.11"
1818

19-
- run: pip install ruff
20-
- run: ruff check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
21-
- run: ruff format --check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
19+
- run: uv sync
20+
- run: uv run ruff check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
21+
- run: uv run ruff format --check coordinode/ langchain-coordinode/ llama-index-coordinode/ tests/
2222

2323
test:
2424
name: Test (Python ${{ matrix.python-version }})
2525
runs-on: ubuntu-latest
2626
strategy:
27+
fail-fast: false
2728
matrix:
28-
python-version: ["3.9", "3.11", "3.12"]
29+
python-version: ["3.11", "3.12", "3.13"]
2930
steps:
30-
- uses: actions/checkout@v4
31+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3132
with:
3233
submodules: recursive
3334

34-
- uses: actions/setup-python@v5
35+
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
3536
with:
3637
python-version: ${{ matrix.python-version }}
3738

38-
- name: Install protoc
39-
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
40-
41-
- name: Install packages
42-
run: |
43-
pip install grpcio-tools
44-
pip install -e "coordinode[dev]"
45-
pip install -e langchain-coordinode/
46-
pip install -e llama-index-coordinode/
39+
- name: Install dependencies
40+
run: uv sync
4741

4842
- name: Generate proto stubs
49-
run: make proto
43+
run: uv run make proto
5044

5145
- name: Unit tests
52-
run: pytest tests/unit/ -v
46+
run: uv run pytest tests/unit/ -v
5347

5448
test-integration:
5549
name: Integration tests
@@ -60,30 +54,36 @@ jobs:
6054
ports:
6155
- 7080:7080
6256
- 7084:7084
63-
options: >-
64-
--health-cmd "wget -qO- http://localhost:7084/health || exit 1"
65-
--health-interval 10s
66-
--health-timeout 5s
67-
--health-retries 12
6857
steps:
69-
- uses: actions/checkout@v4
58+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7059
with:
7160
submodules: recursive
7261

73-
- uses: actions/setup-python@v5
62+
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
7463
with:
7564
python-version: "3.11"
7665

77-
- name: Install protoc
78-
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
66+
- name: Wait for coordinode
67+
run: |
68+
echo "Waiting for coordinode to be ready (HTTP :7084 + gRPC :7080)..."
69+
for i in $(seq 1 30); do
70+
if curl -sf http://localhost:7084/health >/dev/null 2>&1 && \
71+
(echo > /dev/tcp/localhost/7080) 2>/dev/null; then
72+
echo "coordinode is ready (attempt $i)"
73+
exit 0
74+
fi
75+
echo "Attempt $i/30 — not ready yet, sleeping 5s..."
76+
sleep 5
77+
done
78+
echo "Error: coordinode did not become healthy after 150s" >&2
79+
exit 1
7980
8081
- name: Install + generate proto
8182
run: |
82-
pip install grpcio-tools
83-
pip install -e "coordinode[dev]"
84-
make proto
83+
uv sync
84+
uv run make proto
8585
8686
- name: Integration tests
8787
env:
8888
COORDINODE_ADDR: "localhost:7080"
89-
run: pytest tests/integration/ -v --timeout=30
89+
run: uv run pytest tests/integration/ -v --timeout=30
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4
17+
id: rp
18+
with:
19+
config-file: release-please-config.json
20+
manifest-file: .release-please-manifest.json

.github/workflows/release.yml

Lines changed: 16 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: Release
22

3-
# Triggered manually: create a tag v0.3.0 → GitHub Release → this workflow publishes to PyPI.
4-
# Tag format: v{MAJOR}.{MINOR}.{PATCH} → stable, publishes to PyPI
5-
# v{MAJOR}.{MINOR}.{PATCH}a{N} → pre-release, publishes to TestPyPI only
3+
# Triggered automatically by release-please (see release-please.yml):
4+
# 1. Merge release PR → release-please tags the commit → this workflow publishes to PyPI.
5+
# Tag format: v{MAJOR}.{MINOR}.{PATCH} → stable release
6+
# v{MAJOR}.{MINOR}.{PATCH}a{N} → pre-release (published to PyPI with --pre required)
67

78
on:
89
push:
@@ -26,65 +27,37 @@ jobs:
2627
- name: llama-index-graph-stores-coordinode
2728
path: llama-index-coordinode
2829
steps:
29-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3031
with:
3132
submodules: recursive
3233
fetch-depth: 0 # hatch-vcs needs full history for tag detection
3334

34-
- uses: actions/setup-python@v5
35+
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
3536
with:
3637
python-version: "3.11"
3738

38-
- name: Install protoc + build tools
39-
run: |
40-
sudo apt-get update && sudo apt-get install -y protobuf-compiler
41-
pip install hatchling hatch-vcs grpcio-tools build
39+
- name: Install build tools
40+
run: uv sync
4241

4342
- name: Generate proto stubs (coordinode only)
4443
if: matrix.package.name == 'coordinode'
45-
run: make proto
44+
run: uv run make proto
4645

4746
- name: Build wheel + sdist
4847
working-directory: ${{ matrix.package.path }}
49-
run: python -m build
48+
run: uv run python -m build
5049

5150
- name: Upload dist artifact
52-
uses: actions/upload-artifact@v4
51+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
5352
with:
5453
name: dist-${{ matrix.package.name }}
5554
path: ${{ matrix.package.path }}/dist/
5655
retention-days: 1
5756

58-
publish-testpypi:
59-
name: Publish to TestPyPI (pre-release)
60-
runs-on: ubuntu-latest
61-
needs: build
62-
if: contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc')
63-
environment: testpypi
64-
permissions:
65-
id-token: write
66-
strategy:
67-
matrix:
68-
package:
69-
- coordinode
70-
- langchain-coordinode
71-
- llama-index-graph-stores-coordinode
72-
steps:
73-
- uses: actions/download-artifact@v4
74-
with:
75-
name: dist-${{ matrix.package }}
76-
path: dist/
77-
78-
- uses: pypa/gh-action-pypi-publish@release/v1
79-
with:
80-
repository-url: https://test.pypi.org/legacy/
81-
packages-dir: dist/
82-
8357
publish-pypi:
84-
name: Publish to PyPI (stable)
58+
name: Publish to PyPI
8559
runs-on: ubuntu-latest
8660
needs: build
87-
if: "!contains(github.ref_name, 'a') && !contains(github.ref_name, 'b') && !contains(github.ref_name, 'rc')"
8861
environment: pypi
8962
permissions:
9063
id-token: write
@@ -95,12 +68,12 @@ jobs:
9568
- langchain-coordinode
9669
- llama-index-graph-stores-coordinode
9770
steps:
98-
- uses: actions/download-artifact@v4
71+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
9972
with:
10073
name: dist-${{ matrix.package }}
10174
path: dist/
10275

103-
- uses: pypa/gh-action-pypi-publish@release/v1
76+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
10477
with:
10578
packages-dir: dist/
10679

@@ -111,13 +84,13 @@ jobs:
11184
permissions:
11285
contents: write
11386
steps:
114-
- uses: actions/download-artifact@v4
87+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
11588
with:
11689
pattern: dist-*
11790
merge-multiple: true
11891
path: dist/
11992

120-
- uses: softprops/action-gh-release@v2
93+
- uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
12194
with:
12295
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
12396
generate_release_notes: true

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Generated proto stubs — run `make proto` to regenerate
2-
coordinode/_proto/coordinode/
2+
coordinode/_proto/
33

44
# Build artifacts
55
dist/
@@ -18,5 +18,6 @@ env/
1818

1919
# Version files generated by hatch-vcs
2020
coordinode/_version.py
21-
langchain_coordinode/_version.py
22-
llama_index/graph_stores/coordinode/_version.py
21+
langchain-coordinode/langchain_coordinode/_version.py
22+
llama-index-coordinode/llama_index/graph_stores/coordinode/_version.py
23+
GAPS.md

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.3.0"
3+
}

Makefile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,45 @@
1-
.PHONY: proto proto-check install test test-unit test-integration lint clean
1+
.PHONY: proto proto-check install install-pip test test-unit test-integration lint clean
22

33
PROTO_SRC := proto
44
PROTO_OUT := coordinode/_proto
5+
PYTHON ?= python3
56

67
# Generate gRPC stubs from proto submodule into coordinode/_proto/
78
proto:
89
@echo "==> Generating proto stubs..."
910
@mkdir -p $(PROTO_OUT)
10-
python -m grpc_tools.protoc \
11+
$(PYTHON) -m grpc_tools.protoc \
1112
-I$(PROTO_SRC) \
1213
--python_out=$(PROTO_OUT) \
1314
--grpc_python_out=$(PROTO_OUT) \
1415
--pyi_out=$(PROTO_OUT) \
1516
$$(find $(PROTO_SRC) -name '*.proto')
1617
@# Add __init__.py to every generated package directory
1718
@find $(PROTO_OUT) -type d -exec touch {}/__init__.py \;
18-
@# Fix relative imports in generated *_pb2_grpc.py files (grpc_tools generates absolute)
19-
@find $(PROTO_OUT) -name '*_pb2_grpc.py' -exec sed -i '' \
20-
's/^from coordinode\./from coordinode._proto.coordinode./g' {} \;
19+
@# Fix absolute imports in all generated pb2 files (grpc_tools generates absolute paths)
20+
@# sed -i.bak is portable: macOS needs empty-string backup arg, GNU sed uses -i alone;
21+
@# using .bak suffix works on both, then we clean up the backup files.
22+
@find $(PROTO_OUT) -name '*.py' -exec sed -i.bak \
23+
's/from coordinode\.v1\./from coordinode._proto.coordinode.v1./g' {} \;
24+
@find $(PROTO_OUT) -name '*.py.bak' -delete
2125
@echo "==> Proto generation complete: $(PROTO_OUT)/"
2226

2327
proto-check:
2428
@test -f $(PROTO_OUT)/coordinode/v1/query/cypher_pb2.py || \
2529
(echo "ERROR: Proto stubs not generated. Run: make proto" && exit 1)
2630

27-
# Install all packages in editable mode for development
28-
install: proto
31+
# Install using uv (recommended for contributors).
32+
# uv sync runs first — it installs grpcio-tools which proto generation requires.
33+
install:
34+
uv sync
35+
$(MAKE) proto
36+
37+
# Install using pip (alternative — works without uv)
38+
install-pip:
2939
pip install -e "coordinode[dev]"
3040
pip install -e langchain-coordinode/
3141
pip install -e llama-index-coordinode/
42+
$(MAKE) proto
3243

3344
test: proto-check test-unit
3445

0 commit comments

Comments
 (0)