ParaView backward compatibility framework does not support deprecating proxy
TLDR: ParaView backward compatibility framework does not support deprecating a proxy while keeping retro compatibily by using another proxy.
First lets fix some vocabulary:
- Deprecation: Flagging a component or service as outdated and slated for removal in the future, so that user can adapt their process.
- Backward compatibility: Make modern version of a software working with old process.
ParaView has deprecation and backward compatibility framework and they usually works quite well.
There is one simple usecase that is not supported by the backward compatibility framework, the removal of an existing proxy, like a filter.
- Deprecating a filter
A proxy can be tagged as deprecated
using the following syntax:
<SourceProxy class="vtkMyFilter"
name="MyFilter">
<Deprecated deprecated_in="5.10" to_remove_in="5.12">
This has been replaced by 'ProbeLine'. Please consider
using that instead.
</Deprecated>
Using this filter will warn the user that it is deprecated and that it should change its processes before it is ultimely removed
- Replacing a filter by another with the same name using backward compatibility mechanism
An existing proxy can be replaced by another as long as they keep the same name, it is handled in vtkSMStateVersionController.cxx
for XML and in _backwardscompatibilityhelper.py
for python.
The XML approach is very generic and give all latitude to the developer.
The python approach requires a proxy to exist before being able to modify anything on it.
It means this is possible to swap a filter by another as long as the first proxy actually exist, eg for plot over line:
if compatibility_version <= (5, 9):
if key == "PlotOverLine":
# in 5.10, we changed the backend of Plot Over Line
# This restores the previous backend.
probeLine = builtins.getattr(module, "PlotOverLineLegacy")(**kwargs)
return probeLine
- Deprecating an existing proxy and replacing by another proxy
In this simple case, the python approach breaks as the compat code cannot be reached as the previous name does not exist anymore.
This is a strong limitation of the approach and should be fixed.
- A simple fix would be to have a .xml file dedicated to store old proxy name that would only be accessible when using backward compat mode in python,
- another fix would have all python calls go through some logic to see if a specific name existed at some point and trigger some compat code.