Deprecate typing.no_type_check_decorator · Issue #106309 · python/cpython (original) (raw)

Feature or enhancement

We should deprecate typing.no_type_check_decorator, with a view to removing it in Python 3.15.

Pitch

The typing documentation describes typing.no_type_check_decorator like this:

Decorator to give another decorator the no_type_check() effect.

This wraps the decorator with something that wraps the decorated function in no_type_check().

In 2023, this is frankly misleading for users of the typing module. Unlike its twin @no_type_check, no major type checker has yet added support for no_type_check_decorator, despite the fact that it was added to the typing module in Python 3.5. If it's been 8 years and it still hasn't had support added by any major type checker, it's unlikely to ever be usable or useful. Meanwhile, the decorator is fairly obscure, and you can achieve the same effect using other tools such as @typing.no_type_check and typing.Annotated. There have been a few feature requests to type checkers over the years asking them to add support, but none of them have a significant number of upvotes.

We should simply deprecate @no_type_check_decorator, with a view to removing it in Python 3.15. (Note that I do not propose deprecating @no_type_check, which is supported by mypy and reasonably popular among mypy users.)

Previous discussion

Linked PRs