Beginner Developer: Python extension

Hi, im trying to create a python extension,
i tried following both java and python tutorials with no luck in the last few days - in the end node could not be recognised and ive decided to just give up on using IDE - just don’t want to burn any more time playing with a setup, just want to get on with the logic even if debugging is gonna be harder.

My question is - could someone advise what would be bare minimu files needed in \AppData\Local\Programs\KNIME\plugins\ path to have a plugin with one input, one output and python pandas in the middle? I just want to modify .py file logic, change icon and node name.

Are there any simple existing python nodes that i could use as a starting point that you could recommend looking at?

Hey there,

good luck with developing your extension.

Not enough time in the day to give you a walk through right now, but what I can offer is for you to check out my finance extension on github:

Node .py files are located in /src/nodes/…/

A simple one to check out could be the pmt function:

Also moving this to the python extension development section - maybe someone from the KNIME team can pick this up!

Thank you for sharing! Another question - if i download files and drop them into dropins or plugins, nodes should become available after restarting knime?
I cannot seem to find them in knime…

Folder path should be right:
AppData\Local\Programs\KNIME\plugins\DataNautics-KNIME-Finance-Extension-main
in there i have all loose files and flders: src, config.yml, knime.yml etc.

I have set Preferences → Knime modern UI → Nodes included: All nodes
Is there a setting that would prevent community nodes from being loaded?

If you want to get inspiration on how to build a python extension then you can review the extension on GitHub.

I you want to use the extension you best install it from the relevant update site. Go to Preferences => Install/Update => Available Software Sites and make sure that community contributions as per below is active and potentially reload it

Then go to Menu => Install Extensions and in the pop up search for Fin. Then Select Financial Operations and FP&A extension and click next, accept licenses etc. until it installs.

Once it has finished installing after a restart you should find the nodes in your node repository

1 Like

Enabled and reloaded community contributions, but its strange - seems to be missing financial ops:

Which version are you on? I think I first released it for v5.7 (may be able to built it for 5.5+ later on).

5.5.2 - that explains it, thanks

1 Like

On my end, defining node categories seems to be broken.

Does it work for you when not installing the extension from an update site but instead simply adding the extension to the config.yml file?

And does defining any other category than /community work for you?

At what stage are the not categories missing?

Are you still in development mode or have you built your extension and installed it?

If you are still in development mode, then it can be normal. I think it is a known bug or missing feature at least in modern UI that note categories do not show up correctly - i.e. in Modern UI they show as Uncategorized - when you switch to Classic UI you can see them in the correct category.

Once you’ve built your extension and installed it, you should see the categories both in modern UI and in classic UI.

I don’t think you can choose anything else other than community, maybe partner, or so I have not yet done that.

2 Likes

Thanks for your quick reply.

Yep, extensions are not installed (and bundled before installation). Instead the extensions are implemented using a config.yml which points to the respective src and python_executable.

But: Extensions are not in development resp. debug_mode. The config.yml defines debug_mode: false.

I think it is a known bug or missing feature at least in modern UI that note categories do not show up correctly - i.e. in Modern UI they show as Uncategorized - when you switch to Classic UI you can see them in the correct category

Thanks, good to know. I’ll try with Classic UI then. (And hope for a quick fix in Modern UI.)

1 Like

I mean more in general while you’re starting the extension by including the reference to your config yml file in your knime.ini:

-Dknime.python.extension.config=<path/to/your/config.yml>

While you’re running your extension that way i.e. you are developing it in modern UI you will not see any categories for your notes.

yeah, that’s the config.yml I was talking about. :slight_smile:

So when implemented via the config.yml, it won’t show categories for my nodes in modern UI? This needs a fix. :slight_smile:

Yep - but again only modern UI and it works once you bundle and install. I

Unluckily I cannot bundle (yet), since I can’t use conda/pixi. For solid reasons I’m restricted to using venv/pip. I’m yet to reverse engineer the bundling process - though I think this might get complex due to dependency to maven.

So I’ll have to wait for the bugfix. :slight_smile: