Skip to content

Commit

Permalink
Use importlib.metadata instead of pkg_resources
Browse files Browse the repository at this point in the history
pkg_resources is deprecated and emits warning messages.

Fixes #131
  • Loading branch information
jnns committed Apr 14, 2023
1 parent c032492 commit 8d8e2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
long_description_content_type="text/x-rst",
license="MIT license",
python_requires=">=3.7",
requires=["django (>=2.2)"],
requires=["django (>=2.2)", "importlib_metadata;python_version<'3.8'"],
packages=["widget_tweaks", "widget_tweaks.templatetags"],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
11 changes: 5 additions & 6 deletions widget_tweaks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution("django-widget-tweaks").version
except DistributionNotFound:
# package is not installed
__version__ = None
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

__version__ = version("django-widget-tweaks")

0 comments on commit 8d8e2b9

Please sign in to comment.