Description
This is an attempt to centralize discussion about using @(warnings/typing_extensions).deprecated()
in typeshed to convey "typing-only" deprecations, not just runtime-related ones. I'm currently trying to use the decorator that way in #12087, and only just now saw it brought up in another PR as well. @AlexWaygood made some good points (imo) about things to consider when using @deprecated()
with an (artificial or natural) overload this way, so I figured moving such discussion to its own dedicated thread was well warranted.
I linked messages with points in favor of using @deprecated()
this way below (because I'm too lazy right now to rephrase them into clean bullets, but it'll happen at some point):
- In a message here from @srittau in a PR comment chain.
- In a PR of mine, e.g. in the first message of Fix the signatures of
@(async)contextmanager
#12087, under "Additional Rationale", and in a later comment.
Then, a few starting questions and concerns quoted from Alex (hope you don't mind):
- Are we planning on removing the [deprecated] overload eventually?
- If so, how long a deprecation period are we planning on giving?
- Should we communicate that deprecation period in the message to the user?
- How will we remember to remove the deprecated overload when we reach the end of the deprecation period?
- Should we have a policy around this?
- Do we need some clear language here to make clear that there's not actually any indication that runtime support for this will ever be removed, it's just a typing-only deprecation?
- ... the main point I want us to remember is that deprecations can still be really disruptive, but we don't have a good sense of how disruptive at all in our CI at the moment, because mypy doesn't support
@deprecated()
yet, so nothing will show up in mypy_primer.
Hope this is useful and not just me being overzealous.
EDIT: Also including a link to a message by @Akuli in one of the comment chains mentioned earlier, which gives an example for making the choice between using deprecated
vs. removing a function stub entirely, and what consideration can go into that.