Add named inputs/outputs and edge labels for Python script nodes#344
Merged
Edwardvaneechoud merged 15 commits intomainfrom Mar 14, 2026
Merged
Add named inputs/outputs and edge labels for Python script nodes#344Edwardvaneechoud merged 15 commits intomainfrom
Edwardvaneechoud merged 15 commits intomainfrom
Conversation
Extend kernel execution to support named input keys derived from source
node references (e.g., flowfile.read_input("orders")) while keeping
backward compatibility via the "main" key. Add multi-output support to
Python Script nodes mirroring the existing UserDefinedNode pattern, with
a UI editor for configuring output names and dynamic handle rendering.
Backend:
- write_inputs_to_parquet accepts optional input_names for per-source keys
- add_python_script resolves input names from source node_reference
- Multi-output loop reads named parquets into _named_outputs dict
- NodePythonScript gains output_names field (default: ["main"])
- New GET /node/input_names endpoint for frontend discovery
- NodeInput schema carries output_names for frontend serialization
Frontend:
- NodeWrapper renders handle labels when nodes have multiple handles
- PythonScript settings panel: output names editor + available inputs display
- Dynamic autocomplete for read_input("name") in code editor
- API client method for input names endpoint
- Updated FlowfileApiHelp with named I/O documentation
- TypeScript types and defaults updated across flow/node types
https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
When a node has multiple named outputs, the connection lines (edges) leaving each output handle now display the output name as a label. Labels are applied in all edge creation paths: manual connections, flow import, and multi-node copy-paste. Edge label CSS counters the existing color inversion filter so labels render with normal colors. https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
Include node_reference in the backend NodeInput schema and get_node_input() serialization so the frontend receives it. Use node_reference as the edge label when the source node has one set (e.g., "orders", "clients" connecting into a python_script). Named output labels (e.g., "valid", "invalid") take precedence over node_reference for multi-output nodes. https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
The resolve_node_paths() method hardcoded all input parquet files under
the "main" key, so flowfile.read_input("orders") failed in the
interactive notebook editor. The files are named {name}_{index}.parquet
(e.g. orders_0.parquet), so parse the input name from each filename
and group paths accordingly. A "main" key is still added as a
backward-compatible alias pointing to all input files.
https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
- Edge labels now update reactively when node_reference changes
(no UI refresh needed)
- Add "Show edge labels" toggle in Execution Settings dialog,
persisted in FlowSettings (show_edge_labels field)
- When no node_reference is set, edges show df_{nodeId} as the
default label instead of being blank
- Toggling edge labels off/on immediately hides/shows all labels
https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
✅ Deploy Preview for flowfile-wasm canceled.
|
12 unit tests for resolve_node_paths covering: named input parsing from filenames, main-only grouping, no-op cases (pre-set paths, missing flow_id/node_id), empty/missing input dirs, underscored names, multiple files per name, fallback for files without index suffix, and path translation in local mode. 4 tests for FlowSettings.show_edge_labels covering: default value, explicit false, model_dump/validate roundtrip, and backward compatibility when the field is absent. https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
- Add label? and nodeReference? to NodeData interface in NodeWrapper
so handle labels are recognized by the type checker
- Cast sourceNode.data to Record<string, any> in computeEdgeLabel
since VueFlow's generic node data type defaults to {}
https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Remove EdgeCopyValue from useDragAndDrop.ts and NodeDescriptionEntry from node-store.ts. https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
…/input_names endpoint Improves coverage on kernel/execution.py (named/unnamed input paths, error handling), input_schema.py (output_names defaults and roundtrip), and routes.py (/node/input_names with reference, fallback, empty inputs, and 404 cases). https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
Backend: - Add null guard on node before attribute access in add_python_script - Extract _resolve_input_names helper to eliminate duplicated logic - Use zip(strict=True) to catch input name/table count mismatches - Use model_copy(update=) instead of dump/re-instantiate for template override - Create NodeInputNameInfo Pydantic model for /node/input_names endpoint - Update FlowSettings docstring for show_edge_labels field - Move lazy imports to top-level in test file Frontend: - Create shared NodeHandle interface in flow.types.ts - Create shared InputNameInfo interface in flow.types.ts - Replace all (o: any) callbacks with typed NodeHandle finds - Replace Record<string, any> cast with typed FlowNodeData interface - Type onConnect params with Connection from @vue-flow/core - Use proper types in NodeWrapper NodeData interface - Add parseInt radix parameter - Use unknown instead of any in catch clause https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
…ibility Connection.sourceHandle/targetHandle are string|null but NodeConnection expects specific literal types. Cast them explicitly and use ?? undefined for the computeEdgeLabel call. https://claude.ai/code/session_01M94qqeYWUGVGG7cpJ7z7G3
…dwardvaneechoud/Flowfile into claude/named-node-inputs-outputs-SIjmK
…w_edge_labels default mismatch. Add safe identifier validation for node_reference and output_names, defense-in-depth checks in write_inputs_to_parquet, and graceful fallback when input counts diverge.
…uts-outputs-SIjmK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for named inputs and outputs in Python script nodes, along with visual edge labels to improve data flow clarity in the canvas. Users can now configure multiple named outputs, see available inputs from connected nodes, and optionally display edge labels showing data flow names.
Key Changes
Named Inputs & Outputs
write_inputs_to_parquet()to support named input keys (e.g.,orders,customers) while maintaining backward compatibility with"main"as a fallback/node/input_namesendpoint to retrieve available inputs for a node with source node infoEdge Labels
df_{nodeId}formatrefreshAllEdgeLabels()andupdateEdgeLabelsForNode()functions to sync labels when node references or output names changeCode Generation & Help
Data Flow
Notable Implementation Details
node_referencefield or fallback todf_{source_node_id}flowfile.read_input("main")for backward compatibilityNodePythonScript.output_namesand synchronized with VueFlow node output handlesshowEdgeLabelstoggle and update reactively when node properties change