Icon

include_​python_​library_​in_​workflow

This workflow shows how a custom Python library can be shared with a KNIME workflow, by including the sources.

There is one Python file in this workflow's data area (the ./data folder inside the workflow on disk).
In the Python Script node, we add the data area to the Python path and import the module stored there.

One could do the same for any pure-Python library.

(To make workflow sharing work across operating systems, if the library needs different installations on different systems one would have to build some logic here to import the right module per OS.)

Further example workflows for this setup:
https://hub.knime.com/paolotamag/spaces/Public/latest/Storing_Data_Files_inside_the_Workflow_Data_Area~5NLgbd3FSmvs55-T

https://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_python_import_module~BQEN92dR6W0cUM8R

There is one Python file in this workflow's data area (the ./data folder inside the workflow on disk).In the Python Script node, we add the data area to the Python path and import the module stored there.You could do the same for any pure-Python library.(To make workflow sharing work across operating systems, if the library needs different installations on differentsystems one would have to build some logic here to import the right module per OS.)Further example workflows for this setup:https://hub.knime.com/paolotamag/spaces/Public/latest/Storing_Data_Files_inside_the_Workflow_Data_Area~5NLgbd3FSmvs55-Thttps://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_python_import_module~BQEN92dR6W0cUM8R Obfuscates the name columnGenerate test dataGet absolute path to workflow dataset up conda env Python Script Table Creator Extract ContextProperties Conda EnvironmentPropagation There is one Python file in this workflow's data area (the ./data folder inside the workflow on disk).In the Python Script node, we add the data area to the Python path and import the module stored there.You could do the same for any pure-Python library.(To make workflow sharing work across operating systems, if the library needs different installations on differentsystems one would have to build some logic here to import the right module per OS.)Further example workflows for this setup:https://hub.knime.com/paolotamag/spaces/Public/latest/Storing_Data_Files_inside_the_Workflow_Data_Area~5NLgbd3FSmvs55-Thttps://hub.knime.com/mlauber71/spaces/Public/latest/kn_example_python_import_module~BQEN92dR6W0cUM8R Obfuscates the name columnGenerate test dataGet absolute path to workflow dataset up conda envPython Script Table Creator Extract ContextProperties Conda EnvironmentPropagation

Nodes

Extensions

Links