Skip to content

Commit a17b45a

Browse files
committed
fix(client,demo): reject bool schema_mode, guard _EMBEDDED_PIP_SPEC reference
- _normalize_schema_mode: explicitly reject bool before int branch — True/False would previously be accepted as int 1/0 silently - notebook 03 connect cell: use globals().get('_EMBEDDED_PIP_SPEC', fallback) so the ImportError message is actionable even when the cell runs standalone
1 parent 8b7ceb4 commit a17b45a

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

coordinode/coordinode/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ def _normalize_schema_mode(schema_mode: str | int, mode_map: dict[str, int]) ->
512512
- ``int`` — must be one of the values in *mode_map*; allows round-tripping
513513
``LabelInfo.schema_mode`` / ``EdgeTypeInfo.schema_mode`` back into the call.
514514
"""
515+
if isinstance(schema_mode, bool):
516+
raise ValueError(f"schema_mode must be a str or int, got bool {schema_mode!r}.")
515517
if isinstance(schema_mode, int):
516518
# Accept int to allow round-tripping LabelInfo/EdgeTypeInfo.schema_mode.
517519
valid_ints = set(mode_map.values())

demo/notebooks/03_langgraph_agent.ipynb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,16 @@
179179
" try:\n",
180180
" from coordinode_embedded import LocalClient\n",
181181
" except ImportError as exc:\n",
182+
" # _EMBEDDED_PIP_SPEC is defined in the install cell; fall back to the\n",
183+
" # pinned spec so this cell remains runnable if executed standalone.\n",
184+
" _pip_spec = globals().get(\n",
185+
" \"_EMBEDDED_PIP_SPEC\",\n",
186+
" \"git+https://github.com/structured-world/coordinode-python.git\"\n",
187+
" \"@8da94d694ecaabee6f8380147d02f08220061bfa#subdirectory=coordinode-embedded\",\n",
188+
" )\n",
182189
" raise RuntimeError(\n",
183190
" \"coordinode-embedded is not installed. \"\n",
184-
" f\"Run: pip install {_EMBEDDED_PIP_SPEC}\"\n",
191+
" f\"Run: pip install {_pip_spec}\"\n",
185192
" \" — or start a CoordiNode server and set COORDINODE_ADDR.\"\n",
186193
" ) from exc\n",
187194
"\n",

0 commit comments

Comments
 (0)