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
- @typing.no_type_check_decorator is nonfunctional mypy#6583
- no_type_check_decorator doesn't work google/pytype#1452
- typing.no_type_check is not understood microsoft/pyright#1448 (this issue is about
no_type_check
rather thanno_type_check_decorator
, but it shows that pyright is unlikely to ever support either decorator, unlike mypy which supports the former but not the latter)