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?
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?