Python IDE autocompletion for upcoming VTK 9.1

For shared VTK builds, a shared libpython is needed. If you build Python yourself, use --enable-shared when you configure it.

I never build python, I just use the system install. However I’m going to clean my python environment, it’s likely I have different versions around and confusion is the result.

Hi Will, there’s something funny going on because ā€œ/usr/local/lib/libpython3.6m.aā€ is not where ubuntu puts libpython. The system’s python should be in ā€œ/usr/libā€.

I’m building from scratch, I’ve removed a lot of junk. Thanks for the help, I’m hopeful that this will fix it.

I’m good now, my python environment needed some love. Thanks,

@dgobbi as a first step, do you see any issues replacing import vtk in the Python examples with import vtkmodules.all as vtk?

My thinking here is that users using IDEs will get a list of options etc., (which they don’t get with just import vtk), and this will facilitate learning/comprehension when experimenting.

The second step would be to gradually replace import vtkmodules.all as vtk with just the relevant imports. This does bring it more into line with C++ usage.

I think that’s a great idea.

To satisfy my own curiosity, I tried it with vim-jedi but its autocompletion was slooow for the vtk module (too much stuff inside, must not cache efficiently). Importing just the needed modules was definitely faster.

Thanks, I’l do it.

There is also a significant improvement in importing just the needed modules in Windows!

Well, Linux loads executables and shared libraries/modules by memory-mapping. So loading a library/module for a second time is essentially free, even if the module is huge. The module persists in RAM until memory pressure causes it to swap out.

This issue is ā€œtrackingā€ the porting of the test suite as well.

@ben.boeckel At least we now have a script that users can use to get a list of the needed modules.