Skip to content

General discussion of using @deprecated() (from PEP 702) to signal typing-only deprecations #12092

Open
@Sachaa-Thanasius

Description

@Sachaa-Thanasius

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):

Then, a few starting questions and concerns quoted from Alex (hope you don't mind):

  1. Are we planning on removing the [deprecated] overload eventually?
  2. If so, how long a deprecation period are we planning on giving?
  3. Should we communicate that deprecation period in the message to the user?
  4. How will we remember to remove the deprecated overload when we reach the end of the deprecation period?
  5. Should we have a policy around this?
  6. 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?
  7. ... 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: policyOrganization of the typeshed project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions