Skip to content

Commit

Permalink
replace deprecated pkg_resources API with importlib.metadata (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
wahlflo committed May 13, 2024
1 parent 0992799 commit 1dd702a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ewmh_m2m/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
from pkg_resources import get_distribution, DistributionNotFound
import importlib.metadata

try:
# Change here if project is renamed and does not equal the package name
dist_name = __name__
__version__ = get_distribution(dist_name).version
except DistributionNotFound:
__version__ = importlib.metadata.version(__name__)
except importlib.metadata.PackageNotFoundError:
__version__ = 'unknown'
finally:
del get_distribution, DistributionNotFound
del importlib.metadata

0 comments on commit 1dd702a

Please sign in to comment.