Skip to content

Commit

Permalink
Use importlib.metadata instead of the deprecated/remove pkg_resources…
Browse files Browse the repository at this point in the history
….get_distribution
  • Loading branch information
blag committed Sep 19, 2023
1 parent d4ad4e0 commit fe1e1a5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions user_sessions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from pkg_resources import DistributionNotFound, get_distribution

try:
__version__ = get_distribution("django-user-sessions").version
except DistributionNotFound:
# package is not installed
__version__ = None
from importlib.metadata import version
except ImportError:
from pkg_resources import DistributionNotFound, get_distribution

try:
__version__ = get_distribution("django-user-sessions").version
except DistributionNotFound:
# package is not installed
__version__ = None
else:
__version__ = version("django-user-sessions")

0 comments on commit fe1e1a5

Please sign in to comment.