Skip to content

Commit 6d51259

Browse files
authored
Replace deprecated pkg_resources (#45)
* replace deprecated pkg_resources package * Update supported python versions
1 parent 420214f commit 6d51259

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
'Programming Language :: Python :: 3.7',
2424
'Programming Language :: Python :: 3.8',
2525
'Programming Language :: Python :: 3.9',
26+
'Programming Language :: Python :: 3.10',
27+
'Programming Language :: Python :: 3.11',
28+
'Programming Language :: Python :: 3.12',
2629
'Topic :: Scientific/Engineering',
2730
]
2831

src/xoak/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
from pkg_resources import DistributionNotFound, get_distribution
1+
try:
2+
from importlib.metadata import version, PackageNotFoundError
3+
except ImportError:
4+
# Python < 3.8
5+
from importlib_metadata import version, PackageNotFoundError
26

37
from .accessor import XoakAccessor
48
from .index import IndexAdapter, IndexRegistry
59

610
try:
7-
__version__ = get_distribution(__name__).version
8-
except DistributionNotFound: # pragma: no cover
11+
__version__ = version(__name__)
12+
except PackageNotFoundError: # pragma: no cover
913
# package is not installed
1014
pass

0 commit comments

Comments
 (0)