Skip to content

Commit

Permalink
Fix: pkg_resources is obsolete to get package version
Browse files Browse the repository at this point in the history
Solution: Use `importlib.metadata.version` instead.
  • Loading branch information
hoh committed Jun 13, 2024
1 parent 02490d1 commit f62d04b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/aleph/sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import PackageNotFoundError, version

from aleph.sdk.client import AlephHttpClient, AuthenticatedAlephHttpClient

try:
# Change here if project is renamed and does not equal the package name
dist_name = "aleph-sdk-python"
__version__ = get_distribution(dist_name).version
except DistributionNotFound:
__version__ = version("aleph-sdk-python")
except PackageNotFoundError:
__version__ = "unknown"
finally:
del get_distribution, DistributionNotFound

__all__ = ["AlephHttpClient", "AuthenticatedAlephHttpClient"]
__all__ = ["__version__", "AlephHttpClient", "AuthenticatedAlephHttpClient"]


def __getattr__(name):
Expand Down

0 comments on commit f62d04b

Please sign in to comment.