-
-
Notifications
You must be signed in to change notification settings - Fork 993
Open
Description
Overview
App
is imported in textual.__init__
only within a TYPE_CHECKING
block, but linters and type checkers incorrectly
believe that from textual import App
is valid code.
Problem
In /src/textual/__init__.py
:
if TYPE_CHECKING:
from textual.app import App
This causes mypy and other tools to think that App is available for import from the textual module:
from textual import App # This appears valid to linters
$ mypy example.py
Success: no issues found in 1 source file
Expected Behavior
Linters should show an error when trying to import App from textual since it's only available during type checking, not at runtime.
Actual Behavior
Linters incorrectly validate from textual import App as valid code, misleading developers into thinking this import
works when it will fail at runtime.
Impact
Developers may write code that passes linting but fails at runtime due to the misleading import validation.
Fix
Metadata
Metadata
Assignees
Labels
No labels