Python with Code Node

I see that there’s now an option to run Python with the Code Node.
Is it possible to pass the items object that is currently used when running JS code to the python and return it back to the rest of the JS nodes?
I read in the docs that the packages are limited “This limits the available Python packages to the Packages included with Pyodide”. I’m not familiar with Pyodide, is there a way around this to add more packages?

Thank you.

Hi @Itay :wave: Nice to see you again on the community forums!

You’d have to build this on your own in order to include any additional packages. Maybe our resident custom node builders @Jon or @marcus could help you out with this one? :pray:

1 Like

That’s unfortunate. My Plan B is to run process using JS and pass arguments to the python script that is saved as a file.
Thank you for your answer @EmeraldHerald

Hey @Itay,

Can you share more on what you are actually trying to do?

Hey @Jon ,

I have this workflow with many Code Nodes. So far I’ve written every code node in JS while returning “items” object after every node. This way I pass items between all nodes. I would like some of the nodes to run python code. Read the same items dictionary and return it so that the rest of the nodes can use it.

Hey @Itay,

It should be the same with the Python option, Can you share a small workflow example where it doesn’t work?

I didn’t create any workflow using Python yet. I was wondering how it works before I invest time.
My first concern was external packages, can I add pip packages that are not included with “Pyodide”?
My second concern was managing the information between nodes. So far I always used the items object to pass information. If I understood correctly you said it’ll work the same way.
Is there an example how to import the items object with Python code and return it?

Hey @Itay,

For the data items it is mostly the same, When you add the code node to your workflow and select Python we show an example for how you can use things.

Officially we only support pacakges that are included with Pyodide which allows us to provide a secure sandbox for running the Python code in. If you were after using pip and more than what Pyodide offers you would need to create a custom image that includes python and use the exectute command node to run python scripts instead of using the code node.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.