[vtk-developers] Speeding up `import vtk`

Ben Boeckel ben.boeckel at kitware.com
Fri Dec 15 11:55:47 EST 2017


On Fri, Dec 15, 2017 at 11:30:27 -0500, Jean-Christophe Fillion-Robin wrote:
> That said, I still like the idea of implementing lazy loading by default
> and having vtkConfig to disable it.

That whole lazy loading thing looks finicky to me. Personally, I'd
rather just deprecate the old behavior of bringing everything into
scope on import, but `vtkmodules` is a good middleground.

>   from vtkmodules import vtkSomeFactory
>   vtkSomeFactory.SetDefaultClass("vtkNameOfSomeClass")

This would be `from vtkmodules.vtkSomeModule import vtkSomeFactory`. The
point of vtkmodules is that the top-level package *doesn't* import
everything.

--Ben


More information about the vtk-developers mailing list