Suggested by mypy documentation:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import …
Works in mypy, pyright, pyrefly. Found in setuptool_scm generated __version__.py
:
TYPE_CHECKING = False
if TYPE_CHECKING:
from typing import …
Works in mypy, pyright, pyrefly. Best variant for CircuitPython?
def const(x): return x
TYPE_CHECKING = const(0)
if TYPE_CHECKING:
from typing import …
Works in mypy only. Does not work in pyright, pyrefly:
if False:
from typing import …
Entry first conceived on 26 August 2025, 13:18 UTC, last modified on 26 August 2025, 19:03 UTC
Website Copyright © 2004-2024 Jeff Epler