Repository navigation
feat(python): live pandas mesh node + interactive PandasExplorer frontend - #180
Conversation
…tend + language-first-class Code nodes A Python participant (py/pandas) holds a live pandas DataFrame as persistent in-process state (CodeWorker doesn't persist — added a persistent namespace so df survives calls), controllable over the mesh via typed PandasCommand (load/append/groupby/rolling/describe/ reset) + SubmitCodeRequest, and renders it back as a real typed DataGridControl (byte-exact through the .NET serializer — no markdown/HTML). PandasExplorer NodeType: an interactive .NET layout area whose buttons + text input each post a PandasCommand to py/pandas and re-render the returned DataGrid — a proper frontend driving a live Python object. Graceful no-node-attached state (bounded, never hangs). Code nodes: language selector in the Edit view (csharp/python/ts/js/json/sql/markdown) + language-aware icons — the missing UI to author Python nodes (execution routing existed). pytest 28/28, PandasDataGridWireTest 2/2, PandasExplorerAreaTest 3/3, link-integrity green, Release -warnaserror clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds an end-to-end “live pandas DataFrame over the mesh” sample, spanning a Python participant backend (py/pandas), a .NET NodeType frontend that drives it via mesh messages, and tests/docs to pin the wire contract (typed DataGridControl, not markdown/HTML). It also extends Code-node UX so Code nodes can be authored with an explicit language (incl. Python) and show language-aware glyphs in navigation.
Changes:
- Introduces a Python
meshweaver.examples.pandas_nodeparticipant that holds a persistent in-processpandas.DataFrame, supports typed commands +SubmitCodeRequest, and renders state asDataGridControlJSON. - Adds a .NET
PandasExplorerNodeType + layout area that postsPandasCommands topy/pandasand renders the returnedDataGridControl, with a no-participant degraded UI path. - Improves Code node authoring with a language selector + language-aware nav icons (C#/Py/JS/TS).
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/MeshWeaver.Layout.Test/PandasExplorerAreaTest.cs | Adds layout-area integration tests for PandasExplorer (renders grid, posts groupby, no-participant notice). |
| test/MeshWeaver.Layout.Test/PandasDataGridWireTest.cs | Pins the Python-emitted DataGrid JSON and validates it deserializes to typed DataGridControl/columns. |
| test/MeshWeaver.Layout.Test/MeshWeaver.Layout.Test.csproj | Link-compiles PandasExplorer sample sources into tests to keep a single source of truth. |
| src/MeshWeaver.Graph/CodeLayoutAreas.cs | Adds Code-node language options, reads sibling language for icons, and persists language from the editor UI. |
| src/MeshWeaver.Documentation/Data/DataMesh/PythonPandasNode.md | New documentation page describing the pandas participant model + wire contract + frontend node. |
| src/MeshWeaver.Documentation/Data/DataMesh/NodeTypes.md | Adds a link/entry for the new Python pandas node documentation. |
| src/MeshWeaver.Documentation/Data/DataMesh/CallingPython.md | Adds a “Related” link to the stateful pandas participant doc. |
| src/MeshWeaver.Application.Styles/CustomIcons.cs | Adds simple language glyph icons and a ForLanguage(...) mapper. |
| samples/Graph/Data/PythonDemo/PandasExplorer/Source/PandasExplorerLayoutAreas.cs | Implements interactive PandasExplorer layout area (toolbar + reactive grid + graceful degradation). |
| samples/Graph/Data/PythonDemo/PandasExplorer/Source/PandasExplorer.cs | Adds the PandasExplorer content record plus PandasCommand/view command models. |
| samples/Graph/Data/PythonDemo/PandasExplorer/LiveFrame.json | Adds a persistent sample instance node driving the explorer. |
| samples/Graph/Data/PythonDemo/PandasExplorer.json | Registers the PandasExplorer NodeType definition in samples. |
| clients/python/tests/test_pandas_node.py | Adds pytest coverage for dtype→column mapping, mutation persistence, and code-surface persistence. |
| clients/python/scripts/gen_proto.sh | Uses ${PYTHON:-python3} for protoc generation for portability. |
| clients/python/pyproject.toml | Adds pandas to optional deps (examples/dev) for the new example participant. |
| clients/python/meshweaver/examples/pandas_node.py | Implements the stateful pandas participant + command protocol + demo/serve entry points. |
| clients/python/meshweaver/examples/init.py | Introduces the examples package and documents the pandas example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var (currentCode, currentLanguage) = edited; | ||
| var chosenLanguage = string.IsNullOrWhiteSpace(currentLanguage) | ||
| ? codeConfig.Language | ||
| : currentLanguage; | ||
| var updatedCodeConfiguration = codeConfig with | ||
| { | ||
| Code = currentCode, | ||
| Language = chosenLanguage!, | ||
| }; |
| host.GetDataStream<string>(GroupByColumnId) | ||
| .Take(1) | ||
| .Subscribe(column => | ||
| View(host, PandasViewCommand.GroupBy( | ||
| string.IsNullOrWhiteSpace(column) ? DefaultGroupBy : column!.Trim()))); |
| /// camelCase field names — exactly what <c>pandas_node.PandasNode._apply</c> reads off the message. | ||
| /// The participant answers grid commands with a <see cref="DataGridControl"/> and mutations with an ack. | ||
| /// </summary> | ||
| public record PandasCommand : IRequest<DataGridControl> |
Test Results (shard 1)1 008 tests - 106 1 008 ✅ - 104 3m 8s ⏱️ - 1m 7s Results for commit dcf4b93. ± Comparison against base commit 0cac4e7. This pull request removes 125 and adds 19 tests. Note that renamed tests count towards both. |
Test Results (shard 2) 14 files ± 0 14 suites ±0 6m 39s ⏱️ -33s Results for commit dcf4b93. ± Comparison against base commit 0cac4e7. This pull request removes 101 and adds 1 tests. Note that renamed tests count towards both. |
Test Results 53 files ± 0 53 suites ±0 17m 53s ⏱️ - 1m 29s Results for commit dcf4b93. ± Comparison against base commit 0cac4e7. This pull request removes 226 and adds 25 tests. Note that renamed tests count towards both. |
A genuinely interactive Python-mesh integration: a
py/pandasparticipant holds a live pandas DataFrame as persistent in-process state (added a persistent namespace since CodeWorker discards state), controllable over the mesh via typed PandasCommand + code, rendered back as a real typed DataGridControl (byte-exact through the .NET serializer — no markdown/HTML). The PandasExplorer NodeType is the frontend: buttons + a text input each post a command to the participant and re-render the returned DataGrid — a proper frontend driving a live Python object — with a graceful no-node-attached state. Also makes language first-class in Code nodes (the language selector — the missing UI to author Python nodes). pytest 28/28, wire test 2/2, area tests 3/3, link-integrity green, Release -warnaserror clean.🤖 Generated with Claude Code