Skip to content

Enh/ap 25245 pixi env creator#47

Open
marc-lehner wants to merge 34 commits intomasterfrom
enh/AP-25245-pixi-env-creator
Open

Enh/ap 25245 pixi env creator#47
marc-lehner wants to merge 34 commits intomasterfrom
enh/AP-25245-pixi-env-creator

Conversation

@marc-lehner
Copy link
Contributor

Add support for the new python environment provider node and it's pixi port object to the python scripts

@marc-lehner marc-lehner requested a review from a team as a code owner January 26, 2026 12:38
@marc-lehner marc-lehner requested review from Copilot and knime-ghub-bot and removed request for a team January 26, 2026 12:38
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 adds support for a new Python environment provider node with a Pixi port object, integrating it into the Python scripting nodes ecosystem. The changes enable Python script nodes to receive Python environments through an optional input port instead of only relying on configured preferences.

Changes:

  • Introduced PythonProcessProvider as a replacement interface for the deprecated PythonCommand to support multiple environment sources
  • Added optional Python environment port support to Python Script and Python View nodes
  • Implemented environment port extraction and installation logic with progress reporting

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
org.knime.python3/src/main/java/org/knime/python3/PythonCommand.java Deprecated PythonCommand interface, now extends PythonProcessProvider for backward compatibility
org.knime.python3/src/main/java/org/knime/python3/SimplePythonCommand.java Updated documentation to reference PythonProcessProvider
org.knime.python3/src/main/java/org/knime/python3/QueuedPythonGatewayFactory.java Refactored to use PythonProcessProvider instead of PythonCommand
org.knime.python3/src/main/java/org/knime/python3/PythonGatewayFactory.java Updated gateway description to work with PythonProcessProvider
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/script/PythonScriptNodeFactory.java Added optional Python environment port to Python Script node
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/view/PythonViewNodeFactory.java Added optional Python environment port to Python View node
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonScriptNodeModel.java Implemented environment port extraction and prioritization over configured Python command
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonScriptingService.java Added environment port handling for interactive sessions
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonScriptingSession.java Added PythonCommandAdapter to bridge PythonProcessProvider to legacy PythonCommand
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes/PortsConfigurationUtils.java Added utility methods for environment port detection and installation
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonIOUtils.java Updated to filter out environment ports from data processing
org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonScriptingInputOutputModelUtils.java Added logic to skip environment ports in input/output model generation

Copilot AI review requested due to automatic review settings January 26, 2026 17:54
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

Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (2)

org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/script/PythonScriptNodeFactory.java:1

  • The variable pythonEnvClass is declared but never used on line 130 and 139. This appears to be a leftover from development and should be removed to reduce code clutter.
/*

org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/view/PythonViewNodeFactory.java:1

  • The variable pythonEnvClass is declared on line 91 in the view factory but never used. This appears to be a leftover from development and should be removed to reduce code clutter.
/*

@marc-lehner marc-lehner force-pushed the enh/AP-25245-pixi-env-creator branch 2 times, most recently from 5297ab6 to a396f21 Compare February 10, 2026 14:29
Copilot AI review requested due to automatic review settings February 10, 2026 15:28
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

Copilot reviewed 41 out of 41 changed files in this pull request and generated 13 comments.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
18.5% Coverage on New Code (required ≥ 85%)
13.2% Duplication on New Code (required ≤ 1%)

See analysis details on SonarQube Cloud

Copilot AI review requested due to automatic review settings February 11, 2026 08:35
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

Copilot reviewed 41 out of 41 changed files in this pull request and generated 9 comments.

@marc-lehner marc-lehner force-pushed the enh/AP-25245-pixi-env-creator branch from 732d9ac to 15d85da Compare February 11, 2026 09:37
Copilot AI review requested due to automatic review settings February 11, 2026 10:39
@marc-lehner marc-lehner force-pushed the enh/AP-25245-pixi-env-creator branch from 15d85da to 3e4affb Compare February 11, 2026 10:39
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

Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.

Comment on lines 201 to 210
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

This utility method hard-links to PythonEnvironmentPortObject in its signature and body even though org.knime.pixi.port is declared optional. In OSGi, such direct type references can still trigger NoClassDefFoundError at class load/link time (not just at execution), which would prevent the scripting nodes bundle from loading when the optional bundle isn’t available. To keep the dependency truly optional, avoid exposing Pixi types in public method signatures and isolate direct references behind reflection or a separate fragment/bundle that is only resolved when org.knime.pixi.port is present.

Copilot uses AI. Check for mistakes.
@marc-lehner marc-lehner force-pushed the enh/AP-25245-pixi-env-creator branch 2 times, most recently from 68c0942 to d461935 Compare February 11, 2026 15:05
Copilot AI review requested due to automatic review settings February 12, 2026 10:41
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

Copilot reviewed 41 out of 41 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes/PortsConfigurationUtils.java:1

  • filterEnvironmentPort(...) assumes there is exactly one environment port and allocates inObjects.length - 1. If the config ever contains 0 (unexpected state), or more than 1 environment port (future extensibility), this produces an incorrectly sized array (either missing entries or leaving trailing nulls). A more robust approach is to compute the exact number of non-environment ports first (similar to createInputPorts) and allocate based on that count, or build a list and convert to array.
/*

Copilot AI review requested due to automatic review settings February 12, 2026 11:57
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

Copilot reviewed 38 out of 38 changed files in this pull request and generated 7 comments.

Copilot AI review requested due to automatic review settings February 12, 2026 16:19
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

Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

org.knime.python3.scripting.nodes/src/main/java/org/knime/python3/scripting/nodes2/PythonScriptingSession.java:1

  • The extractPythonEnvironmentPort method is called twice in this code block (lines 262 and 266). Store the result in a variable to avoid redundant traversal of the input array.
/*

Copilot AI review requested due to automatic review settings February 13, 2026 14:14
AP-25245 (Python Environment Provider (Preview - Hidden))
Copilot AI review requested due to automatic review settings February 18, 2026 09:50
AP-25245 (Python Environment Provider (Preview - Hidden))
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

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

AP-25245 (Python Environment Provider (Preview - Hidden))
Copilot AI review requested due to automatic review settings February 18, 2026 10:18
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

Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.

AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
…entPort

AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
Copilot AI review requested due to automatic review settings February 18, 2026 12:45
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
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

Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.

because it is only used by the legacy nodes and will be removed.
AP-25245 (Python Environment Provider (Preview - Hidden))
AP-25245 (Python Environment Provider (Preview - Hidden))
Copilot AI review requested due to automatic review settings February 18, 2026 13:06
@HedgehogCode HedgehogCode dismissed chaubold’s stale review February 18, 2026 13:08

Review not up-to-date.

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

Copilot reviewed 34 out of 34 changed files in this pull request and generated 5 comments.

Comment on lines 51 to 56
import org.knime.conda.CondaEnvironmentDirectory;
import org.knime.externalprocessprovider.ExternalProcessProvider;

/**
* Conda-specific implementation of {@link PythonCommand} that works with bundled Python environments. Allows to build
* Conda-specific implementation of {@link ExternalProcessProvider} that works with bundled Python environments. Allows to build
* Python processes for a given Conda environment. Takes care of resolving PATH-related issues on Windows.
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

ExternalProcessProvider is imported but only referenced from Javadoc, so the import is unused and may break strict builds. Remove the import or use the fully-qualified name in the Javadoc link.

Copilot uses AI. Check for mistakes.
} else if (PickledObjectFileStorePortObject.TYPE.equals(portType)) {
numInObjects++;
} else if (isPythonEnvironmentPort(portType)) {
hasEnvironmentPort = true;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

fromCurrentNodeContext() sets hasEnvironmentPort to true based solely on the configured port type (including TYPE_OPTIONAL). For an optional but unconnected environment port this will still be true, but there will be no PythonEnvironmentPortObject instance in PortObject[], causing extractPythonEnvironmentPort(...) callers to fail at runtime.

Suggested change
hasEnvironmentPort = true;
if (nodeContainer.getInPort(i).getPortObject() instanceof PythonEnvironmentPortObject) {
hasEnvironmentPort = true;
}

Copilot uses AI. Check for mistakes.
Comment on lines +264 to +272
public static PythonEnvironmentPortObject extractPythonEnvironmentPort(final PortObject[] inObjects) {
for (final PortObject inObject : inObjects) {
if (inObject instanceof PythonEnvironmentPortObject envPort) {
return envPort;
}
}
throw new IllegalArgumentException(
"Expected a Python environment port object in the input ports, but none was found.");
}
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

extractPythonEnvironmentPort(...) throws IllegalArgumentException if the env port object is absent. Since the env port group is configured as optional, callers should be able to proceed when it is not connected; consider returning Optional<PythonEnvironmentPortObject> (or a nullable value) and letting callers fall back to the configured executable selection.

Copilot uses AI. Check for mistakes.
Comment on lines +53 to +56
import org.knime.externalprocessprovider.ExternalProcessProvider;

/**
* A simple implementation of {@link PythonCommand}. Runs a command that is given by a list of strings.
* A simple implementation of {@link ExternalProcessProvider}. Runs a command that is given by a list of strings.
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

ExternalProcessProvider is only referenced in the Javadoc here, so this import is unused and may fail the build under strict compiler settings. Remove the import or reference the type with its fully-qualified name in the Javadoc.

Copilot uses AI. Check for mistakes.
Comment on lines 51 to 56
import org.knime.conda.CondaEnvironmentDirectory;
import org.knime.externalprocessprovider.ExternalProcessProvider;

/**
* Conda-specific implementation of {@link PythonCommand}. Allows to build Python processes for a given Conda
* Conda-specific implementation of {@link ExternalProcessProvider}. Allows to build Python processes for a given Conda
* installation and environment. Takes care of resolving PATH-related issues on Windows.
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

ExternalProcessProvider is imported but not used in code (only in Javadoc), which can trigger unused-import errors/warnings in the Eclipse/Tycho build. Remove the import or use a fully-qualified type reference in the Javadoc.

Copilot uses AI. Check for mistakes.
AP-25245 (Python Environment Provider (Preview - Hidden))
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.

3 participants

Comments