We need more metadata for our deprecation decorator, but the spec doesn’t say howdeprecated 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:
ifTYPE_CHECKING:
fromwarningsimportdeprecatedelse:
defdeprecated[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?
We need more metadata for our deprecation decorator, but the spec doesn’t say how
deprecatedmarks 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 withwarnings.deprecatedat the type level:We need to define
deprecated(msg: str, version: packaging.Version)and have it work with the type system. How?