Skip to content

AP-25704: add inactive output support for Python nodes#92

Open
AtR1an wants to merge 1 commit intomasterfrom
enh/AP-25704-inactive-ports
Open

AP-25704: add inactive output support for Python nodes#92
AtR1an wants to merge 1 commit intomasterfrom
enh/AP-25704-inactive-ports

Conversation

@AtR1an
Copy link
Contributor

@AtR1an AtR1an commented Mar 20, 2026

No description provided.

@AtR1an AtR1an requested a review from a team as a code owner March 20, 2026 10:10
@AtR1an AtR1an requested review from Copilot and knime-ghub-bot and removed request for a team March 20, 2026 10:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a first-class “inactive output” marker for Python-based KNIME nodes and wires it through the Python↔Java port conversion layer so nodes can explicitly mark specific output slots as inactive.

Changes:

  • Add knext.InactivePort sentinel and document its use in configure()/execute().
  • Map the sentinel to/from KNIME’s InactiveBranchPortObject / InactiveBranchPortObjectSpec in both the Python backend launcher and Java port type registry.
  • Add Python and Java tests covering spec/object conversion and proxy behavior while preserving output arity.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
org.knime.python3.nodes/src/main/python/knime/extension/nodes.py Adds InactivePort sentinel + API doc updates for returning inactive outputs.
org.knime.python3.nodes/src/main/python/knime/extension/__init__.py Re-exports InactivePort on the public knime.extension surface.
org.knime.python3.nodes/src/main/python/_node_backend_launcher.py Converts inactive specs/objects between Python marker and KNIME inactive port types (by class name).
org.knime.python3.nodes/src/main/java/org/knime/python3/nodes/ports/PythonPortTypeRegistry.java Adds Java-side conversion shortcuts for inactive port object/spec.
org.knime.python3.nodes/src/main/java/org/knime/python3/nodes/ports/PythonPortObjects.java Introduces Java-side Python wrapper singletons for inactive port object/spec.
org.knime.python3.nodes.tests/src/test/python/unittest/test_knime_node_backend.py Adds unit tests for inactive conversions and proxy output arity.
org.knime.python3.nodes.tests/src/test/java/org/knime/python3/nodes/ports/InactivePortConversionTest.java Adds Java unit tests for inactive conversions.

Comment on lines 951 to +955
Either a single spec, or a tuple or list of specs. The number of specs
must match the number of defined output ports, and they must be returned in this order.
Alternatively, instead of a spec, a knext.Column can be returned (if the spec shall
only consist of one column).
only consist of one column). Return `knext.InactivePort` for an output slot to
mark that port inactive.
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring only describes returning knext.InactivePort for outputs, but the backend also converts inactive incoming port specs/objects to knext.InactivePort (so *inputs in configure() / execute() can be this marker when an upstream branch is inactive). Consider documenting this input behavior as well, so node authors know they may need to handle/forward inactive inputs.

Copilot uses AI. Check for mistakes.
@AtR1an AtR1an force-pushed the enh/AP-25704-inactive-ports branch from cdb68f6 to 488e201 Compare March 20, 2026 11:12
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
83.3% Coverage on New Code (required ≥ 85%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants