Help for building python plugin

Hello,

I have some python scripts which give access to new filters we developed. For now, to access to this filters in paraview I added to my PV_PLUGIN_PATH the path to my scripts directory and it works well.

I want now to transform this into a paraview plugin which will be then integrated in my gitlab project with CI tests related.

To this end, I follow the examples to how to build a paraview plugin with python files:
https://gitlab.kitware.com/paraview/paraview/-/blob/master/Examples/Plugins/PythonAlgorithm/
and
https://gitlab.kitware.com/paraview/paraview/-/tree/master/Examples/Plugins/PythonOnlyExample

And I have some issues with this =o

Let’s take the simple exemple with PythonOnlyExample. I copied/pasted the folder in my project and change my CMakelist to integrate it in my compilation.
When I load in paraview the created module, I don’t see any change in my GUI but I can go in the integrated pythonShell and do

import helloworld and then have access to helloworld.py declared function (such as “PreserveInputTypeFilter”).
From what I read, this is the normal behavior, so I continue my integration.

I added to this folder the PythonAlgorithmExamples.py file and added to my CMakelist too and rebuild my project.

I load the created module in paraview but don’t see any new sources in my GUI (even with ctrl+space). Here again I can do import PythonAlgorithmExamples and then can call PythonAlgorithmExamples.PythonSuperquadricSource(). However executing this do not create any item in my pipeline and does not seems to have GUI impact.

My conclusion to all of it is that there is something I do not understand and I do the things wrong. However, I search on many issues in this discourse and I could not find answers.

Can somebody explain to me what I do wrong ?

Regards,
EloĂŻse

Hi @Eloise

So you want to build a python plugin into a shared library, is that correct ?

Best,

Yes,
At the end, I want a plugin mypythons.so and load it in paraview =)

Hi @Eloise

Turns out this may not be working as expected:

https://gitlab.kitware.com/paraview/paraview/-/merge_requests/5695

https://gitlab.kitware.com/paraview/paraview/-/issues/21632

Best,

Confirmed to be non fonctionnal (and soon to be cleaned up), but this feature (compiling a python plugin into a shared library) could be added.

I’ve wondered for a while if this was possible, I didn’t know that it was (intended to be)!

Just raising my hand here to say “I want this, too!”

1 Like