Raise DeprecationWarning in Python for deprecated methods
In order to get the deprecation warnings from Python instead of from the VTK_LEGACY_BODY macros in the C++ code, you must configure VTK with VTK_LEGACY_SILENT=ON and call the following from Python:
import warnings
warnings.filterwarnings("default", category=DeprecationWarning)
When building wheels, VTK_LEGACY_SILENT=ON is now set automatically. The warning text is formatted as follows:
DeprecationWarning: Call to deprecated method SetUseStdErrorForAllMessages. (Use
vtkOutputWindow::SetDisplayMode) -- Deprecated since version 9.0.0.
A DeprecationWarning is emitted when:
- A deprecated method is called.
- A static method of a deprecated class is called.
- A constructor of a deprecated class is called.
Closes: #18148 (closed)
Edited by David Gobbi