Is your feature request related to a problem? Please describe.
My project has a module where I switch between the stdlib and typing_extensions depending on the version of Python in use. It looks something like:
myproject/compat.py:
__all__ = [
"deprecated",
]
if sys.version_info >= (3, 13):
from warnings import deprecated
else:
from typing_extensions import deprecated
Then in the rest of the project I do:
from myproject.compat import deprecated
@deprecate("this is deprecated")
def foo():
pass
However, it seems this isn't recognized as the deprecated decorator because the decorator.callable_path is myproject.compat.deprecated.
Describe the solution you'd like
Maybe we could allow setting custom paths for the decorators? Maybe support any decorator with the function name deprecated (seems risky)? I'd rather not have to remove the compat module though or do the if/else outside of my compat.py where the decorator is used.
Describe alternatives you've considered
None
Additional context
Is your feature request related to a problem? Please describe.
My project has a module where I switch between the stdlib and typing_extensions depending on the version of Python in use. It looks something like:
myproject/compat.py:Then in the rest of the project I do:
However, it seems this isn't recognized as the deprecated decorator because the
decorator.callable_pathismyproject.compat.deprecated.Describe the solution you'd like
Maybe we could allow setting custom paths for the decorators? Maybe support any decorator with the function name deprecated (seems risky)? I'd rather not have to remove the compat module though or do the if/else outside of my compat.py where the decorator is used.
Describe alternatives you've considered
None
Additional context