-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Some of our users report that reveal_type
causes problems in runtime: typeddjango/django-stubs#590
I agree that this is indeed problematic. For example:
x = 1
reveal_type(x)
Mypy checks this code, finds 0 issues, returns 0 as the return code. This script will pass the CI, but will break in runtime. This is not what mypy is expected to do: it is expected to find bugs.
So, I propose adding a new error code:
- We can name it
unimported-reveal
- It will be turned off by default
- It will raise errors on all plain
reveal_type
/reveal_locals
usages - If you want to keep
reveal_type
even in production (for some reason), usefrom typing[_extensions] import reveal_type
ortype: ignore[unimported-reveal]
Do others have any objections?
AlexWaygood and JelleZijlstra