Skip to content

Commit

Permalink
fix(python): detect deltalake version in show_versions (#7622)
Browse files Browse the repository at this point in the history
  • Loading branch information
zundertj authored Mar 18, 2023
1 parent d83d4f8 commit 38ab4e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions py-polars/polars/utils/show_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ def _get_dependency_info() -> dict[str, str]:
def _get_dependency_version(dep_name: str) -> str:
try:
module = importlib.import_module(dep_name)
module_version = getattr(module, "__version__", "<version not detected>")
except ImportError:
return "<not installed>"

# all our dependencies (as of 2022-08-11) implement __version__
if hasattr(module, "__version__"):
module_version = module.__version__
elif sys.version_info >= (3, 8):
# importlib.metadata was introduced in Python 3.8
module_version = importlib.metadata.version(dep_name)
else:
module_version = "<version not detected>"

return module_version

0 comments on commit 38ab4e7

Please sign in to comment.