Skip to content

How to extend warnings.deprecated? #2256

@flying-sheep

Description

@flying-sheep

We need more metadata for our deprecation decorator, but the spec doesn’t say how deprecated marks an API. So the only way to mark something as deprecated it is by creating an API with the same exact signature and replace it with warnings.deprecated at the type level:

if TYPE_CHECKING:
    from warnings import deprecated
else:
    def deprecated[F](msg: str) -> Callable[[F], F]: ...

We need to define deprecated(msg: str, version: packaging.Version) and have it work with the type system. How?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions