Skip to content

Commit 62ea048

Browse files
committed
fix(client,demo): align type annotations with runtime; exec in docker; notebook fixes
- Update _build_property_definitions annotation to include tuple[dict, ...] (matches isinstance check) - Update create_text_index annotation to include tuple[str, ...] in async and sync signatures - Add `exec` before start-notebook.sh so Jupyter becomes PID 1 (proper signal handling) - Extract _EMBEDDED_PIP_SPEC constant in notebook 03 to avoid drift on future bumps - Fix query_facts LIMIT guard: skip appending LIMIT 20 when query already has any LIMIT clause (prevents invalid double-LIMIT with parameterized LIMIT $n)
1 parent bf92f4a commit 62ea048

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

coordinode/coordinode/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def _validate_property_dict(p: Any, idx: int) -> tuple[str, str, bool, bool]:
449449

450450
@staticmethod
451451
def _build_property_definitions(
452-
properties: list[dict[str, Any]] | None,
452+
properties: list[dict[str, Any]] | tuple[dict[str, Any], ...] | None,
453453
property_type_cls: Any,
454454
property_definition_cls: Any,
455455
) -> list[Any]:
@@ -613,7 +613,7 @@ async def create_text_index(
613613
self,
614614
name: str,
615615
label: str,
616-
properties: str | list[str],
616+
properties: str | list[str] | tuple[str, ...],
617617
*,
618618
language: str = "",
619619
) -> TextIndexInfo:
@@ -984,7 +984,7 @@ def create_text_index(
984984
self,
985985
name: str,
986986
label: str,
987-
properties: str | list[str],
987+
properties: str | list[str] | tuple[str, ...],
988988
*,
989989
language: str = "",
990990
) -> TextIndexInfo:

demo/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ services:
4040
# /tmp/install-sdk.sh is copied into the image by Dockerfile.jupyter;
4141
# it must run after /sdk is mounted (i.e. at runtime, not during build).
4242
command: >-
43-
bash -c "/tmp/install-sdk.sh && start-notebook.sh"
43+
bash -c "/tmp/install-sdk.sh && exec start-notebook.sh"
4444
depends_on:
4545
coordinode:
4646
condition: service_healthy

demo/notebooks/03_langgraph_agent.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"import os, sys, subprocess\n",
4242
"\n",
4343
"IN_COLAB = \"google.colab\" in sys.modules\n",
44+
"_EMBEDDED_PIP_SPEC = (\n",
45+
" \"git+https://github.com/structured-world/coordinode-python.git\"\n",
46+
" \"@8da94d694ecaabee6f8380147d02f08220061bfa#subdirectory=coordinode-embedded\"\n",
47+
")\n",
4448
"\n",
4549
"# Install coordinode-embedded in Colab only (requires Rust build).\n",
4650
"if IN_COLAB and not os.environ.get(\"COORDINODE_ADDR\"):\n",
@@ -80,7 +84,7 @@
8084
" \"pip\",\n",
8185
" \"install\",\n",
8286
" \"-q\",\n",
83-
" \"git+https://github.com/structured-world/coordinode-python.git@8da94d694ecaabee6f8380147d02f08220061bfa#subdirectory=coordinode-embedded\",\n",
87+
" _EMBEDDED_PIP_SPEC,\n",
8488
" ],\n",
8589
" check=True,\n",
8690
" timeout=600,\n",
@@ -169,7 +173,7 @@
169173
" except ImportError as exc:\n",
170174
" raise RuntimeError(\n",
171175
" \"coordinode-embedded is not installed. \"\n",
172-
" \"Run: pip install git+https://github.com/structured-world/coordinode-python.git@8da94d694ecaabee6f8380147d02f08220061bfa#subdirectory=coordinode-embedded\"\n",
176+
" f\"Run: pip install {_EMBEDDED_PIP_SPEC}\"\n",
173177
" \" — or start a CoordiNode server and set COORDINODE_ADDR.\"\n",
174178
" ) from exc\n",
175179
"\n",
@@ -258,6 +262,10 @@
258262
" return f\"LIMIT {min(int(m.group(1)), 20)}\"\n",
259263
" if _LIMIT_AT_END_RE.search(q):\n",
260264
" q = _LIMIT_AT_END_RE.sub(_cap_limit, q)\n",
265+
" elif re.search(r\"\\bLIMIT\\b\", q, re.IGNORECASE):\n",
266+
" # Respect caller-provided non-terminal / parameterized LIMIT clauses\n",
267+
" # (e.g. LIMIT $n); appending a second LIMIT would produce invalid Cypher.\n",
268+
" pass\n",
261269
" else:\n",
262270
" q = q.rstrip().rstrip(\";\") + \" LIMIT 20\"\n",
263271
" rows = client.cypher(q, params={\"sess\": SESSION})\n",

0 commit comments

Comments
 (0)