tantale / deprecated

Python @deprecated decorator to deprecate old python classes, functions or methods.
MIT License
298 stars 32 forks source link

Deprecate arguments #57

Open dyollb opened 2 years ago

dyollb commented 2 years ago

This is a feature idea, not a bug report.

It would be great if deprecated could warn about deprecated arguments, e.g. like

@deprecated_arg(name="old_arg_name", since="1.2", version=mypackage.__version__, reason="'old_arg_name' is not consistent with some reference")
def my_function(old_arg_name, other_args):
    pass

which would yield a message like:

"my_function" called with deprecated argument "old_arg_name"

Optionally with a new name hint, so

@deprecated_arg(name="old_arg_name", new_name="new_arg_name", since="1.2", version=mypackage.__version__)
def my_function(old_arg_name, other_args):
    pass

which would yield a message like:

"my_function" called with deprecated argument "old_arg_name". Please use "new_arg_name"

kc9jud commented 2 years ago

See also #5 and #8.

mjhajharia commented 1 year ago

i think the maintainer has been inactive for a while so i made a fork that supports arg deprecation https://deprecat.readthedocs.io/en/latest/source/introduction.html#additional-features

repo - https://github.com/mjhajharia/deprecat

docs - https://deprecat.readthedocs.io/en/latest/

tantale commented 1 year ago

Parameter-level depreciation is currently being developed. Stay tune.