Skip to content

Commit 8d8e2b9

Browse files
committed
Use importlib.metadata instead of pkg_resources
pkg_resources is deprecated and emits warning messages. Fixes jazzband#131
1 parent c032492 commit 8d8e2b9

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
long_description_content_type="text/x-rst",
1414
license="MIT license",
1515
python_requires=">=3.7",
16-
requires=["django (>=2.2)"],
16+
requires=["django (>=2.2)", "importlib_metadata;python_version<'3.8'"],
1717
packages=["widget_tweaks", "widget_tweaks.templatetags"],
1818
classifiers=[
1919
"Development Status :: 5 - Production/Stable",

widget_tweaks/__init__.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
from pkg_resources import get_distribution, DistributionNotFound
2-
31
try:
4-
__version__ = get_distribution("django-widget-tweaks").version
5-
except DistributionNotFound:
6-
# package is not installed
7-
__version__ = None
2+
from importlib.metadata import version
3+
except ImportError:
4+
from importlib_metadata import version
5+
6+
__version__ = version("django-widget-tweaks")

0 commit comments

Comments
 (0)