From 49fc78d2a2cd93ee97058a247362ceb53b2ca83f Mon Sep 17 00:00:00 2001 From: Yurii Karabas <1998uriyyo@gmail.com> Date: Thu, 2 Oct 2025 14:46:55 +0200 Subject: [PATCH] Fix type hint aliasing for App under TYPE_CHECKING --- CHANGELOG.md | 1 + src/textual/__init__.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5200430ceb..1c9fe0e242 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fix inability to copy text outside of an input/textarea when it was focused https://github.com/Textualize/textual/pull/6148 - Fix issue when copying text after a double click https://github.com/Textualize/textual/pull/6148 +- Fixed type hint aliasing for App under TYPE_CHECKING https://github.com/Textualize/textual/pull/6152 ## [6.2.0] - 2025-09-30 diff --git a/src/textual/__init__.py b/src/textual/__init__.py index 65f917cff1..cb901f747a 100644 --- a/src/textual/__init__.py +++ b/src/textual/__init__.py @@ -36,7 +36,7 @@ if TYPE_CHECKING: from importlib.metadata import version - from textual.app import App + from textual.app import App as _App __version__ = version("textual") """The version of Textual.""" @@ -65,7 +65,7 @@ def __init__( log_callable: LogCallable | None, group: LogGroup = LogGroup.INFO, verbosity: LogVerbosity = LogVerbosity.NORMAL, - app: App | None = None, + app: _App | None = None, ) -> None: self._log = log_callable self._group = group @@ -73,7 +73,7 @@ def __init__( self._app = None if app is None else weakref.ref(app) @property - def app(self) -> App | None: + def app(self) -> _App | None: """The associated application, or `None` if there isn't one.""" return None if self._app is None else self._app()