Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Description
Feature or enhancement
We should deprecatetyping.no_type_check_decorator
, with a view to removing it in Python 3.15.
Pitch
The typing documentation describestyping.no_type_check_decorator
like this:
Decorator to give another decorator theno_type_check() effect.
This wraps the decorator with something that wraps the decorated function inno_type_check().
In 2023, this is frankly misleading for users of thetyping
module. Unlike its twin@no_type_check
, no major type checker has yet added support forno_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
andtyping.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 Ido 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)