I have my type annotations in a .pyi. Should I add:
TYPE_CHECKING = False
if TYPE_CHECKING:
and all the contents of the file under the if
?
I have my type annotations in a .pyi. Should I add:
TYPE_CHECKING = False
if TYPE_CHECKING:
and all the contents of the file under the if
?
No. This is completely pointless in a .pyi
file and will probably even break stuff in some type checkers.
So .pyi are not evaluated at runtime, but only by type checkers?
Yes. That is the entire point of having them be in different files.