Skip to content

Commit

Permalink
Merge pull request #3845 from branchvincent/importlib-metadata
Browse files Browse the repository at this point in the history
drop importlib-metadata
  • Loading branch information
rodrigogiraoserrao authored Dec 14, 2023
2 parents e1b94e4 + f01d31c commit 49e7186
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
24 changes: 22 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ python = "^3.8"
rich = ">=13.3.3"
markdown-it-py = { extras = ["plugins", "linkify"], version = ">=2.1.0" }
#rich = {path="../rich", develop=true}
importlib-metadata = ">=4.11.3"
typing-extensions = "^4.4.0"
tree-sitter = { version = "^0.20.1", optional = true }
tree_sitter_languages = { version = ">=1.7.0", optional = true }
Expand Down
11 changes: 3 additions & 8 deletions src/textual/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,11 @@


def __getattr__(name: str) -> str:
"""Lazily get the version from whatever API is available."""
"""Lazily get the version."""
if name == "__version__":
try:
from importlib.metadata import version
except ImportError:
import pkg_resources
from importlib.metadata import version

return pkg_resources.get_distribution("textual").version
else:
return version("textual")
return version("textual")
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


Expand Down
2 changes: 1 addition & 1 deletion src/textual/demo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from importlib.metadata import version
from pathlib import Path

from importlib_metadata import version
from rich import box
from rich.console import RenderableType
from rich.json import JSON
Expand Down

0 comments on commit 49e7186

Please sign in to comment.