[vtk-developers] Speeding up `import vtk`

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Mon Dec 11 13:00:37 EST 2017


I went the route of simpler implementation that better handles all
forms of importing vtk including `import vtk` and `from vtk import *`
etc. while still providing me with a package that doesn't import all
the modules.

The implementation is here:
https://gitlab.kitware.com/vtk/vtk/merge_requests/3674

In summary:
* a new `vtkmodules` package replaces the old `vtk` package which has
an empty __init__.py file, thus doesn't import anything by default.
* `vtkmodules.all`  module imports all vtk modules
* vtk.py is a new module that acts as a trampoline, forwarding to the
`vtkmodules` package but also imports everything from the all module.

I'd like to move forward with this change, if there are no objections.
It's 100% backwards compatible.

Utkarsh


More information about the vtk-developers mailing list