Skip to content

Commit

Permalink
Merge pull request #4182 from Textualize/version_typing
Browse files Browse the repository at this point in the history
remove dynamic version
  • Loading branch information
willmcgugan authored Feb 19, 2024
2 parents 2b3c71c + b6f565c commit 3a2e68a
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/textual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,21 @@
LogCallable: TypeAlias = "Callable"


def __getattr__(name: str) -> str:
"""Lazily get the version."""
if name == "__version__":
from importlib.metadata import version
if TYPE_CHECKING:

from importlib.metadata import version

__version__ = version("textual")

else:

def __getattr__(name: str) -> str:
"""Lazily get the version."""
if name == "__version__":
from importlib.metadata import version

return version("textual")
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
return version("textual")
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


class LoggerError(Exception):
Expand Down

0 comments on commit 3a2e68a

Please sign in to comment.