vtk_backend

vtk_backend#

vtk_backend() str[source]#

Return the name of the VTK build PyVista is running against.

'vtk' is stock VTK (the default); 'cvista' is the community fork, selected by installing pyvista[cvista] or setting PYVISTA_VTK_BACKEND before importing PyVista. Use it to branch on features a given build ships. The returned name round-trips through PYVISTA_VTK_BACKEND.

Added in version 0.49.

Returns:
str

Name of the active backend: 'vtk' for stock VTK, otherwise the backend’s package name (e.g. 'cvista').

Examples#

Download Python source code | Download Jupyter notebook

The value depends on which build is installed, so this example is not run.

>>> import pyvista as pv
>>> pv.vtk_backend()
'vtk'

Raise a clear error for a build that cannot support a feature:

>>> if pv.vtk_backend() != 'vtk':
...     msg = (
...         f'This feature is not supported on the {pv.vtk_backend()} backend.'
...     )
...     raise RuntimeError(msg)