[Add] Deprecation system
Context
Solves aidge#32 (closed).
To mark a function as deprecated, simply add the MACRO DEPRECATED("new_func_name");
at the beginning where "new_func_name"
is the name of the function that should be used instead.
Function name is automatically converted to snake_case if a Python environment is detected.
// in Tensor::setdataFormat()
DEPRECATED("toDataFormat");
>>> import aidge_core as ai
>>> ai.Tensor(dims=[1,2,3,4])
>>> a.set_data_format(ai.dformat.nchw)
[WARNING] - 'set_data_format()' is deprecated, please use 'to_data_format()' instead
Add macro when Python binded function name cannot be automatically deduced DEPRECATED_WITH_PYBIND_OVERRIDES
// in Tensor::setdataFormat()
DEPRECATED_WITH_PYBIND_OVERRIDES("toDataFormat", "set_dformat", "to_dformat");
>>> import aidge_core as ai
>>> ai.Tensor(dims=[1,2,3,4])
>>> a.set_dformat(ai.dformat.nchw)
[WARNING] - 'set_dformat()' is deprecated, please use 'to_dformat()' instead
Major modifications
- add:
utils/Deprecation.hpp
Edited by Maxence Naud
Merge request reports
Activity
Filter activity
added Feature 🚀 PriorityMedium StatusReview Ready UI 🎮 labels
assigned to @pineapple
added 10 commits
-
62296e03...482e03ba - 9 commits from branch
dev
- db501b69 - [Add] Deprecation MACRO working for bothC++ and Python binding
-
62296e03...482e03ba - 9 commits from branch
added 5 commits
-
e1b7fee7...9a6798c4 - 3 commits from branch
dev
- 4b2ea1c2 - [Add] Deprecation MACRO working for bothC++ and Python binding
- 3d606ea2 - update deprecation with pybind override
-
e1b7fee7...9a6798c4 - 3 commits from branch
requested review from @cmoineau and @olivierbichler
changed milestone to %aidge v0.6.0
added 47 commits
-
3d606ea2...1fcaee4b - 45 commits from branch
dev
- 4cd6d30f - [Add] Deprecation MACRO working for bothC++ and Python binding
- c53550c1 - update deprecation with pybind override
-
3d606ea2...1fcaee4b - 45 commits from branch
Please register or sign in to reply