From 234fdc0383c0bc4a1ffce7ade4ecbe11727a3b7d Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Wed, 8 Apr 2026 13:43:03 +0300 Subject: [PATCH] Replace deprecated pkg_resources with importlib.metadata --- authority/__init__.py | 6 +++--- docs/conf.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/authority/__init__.py b/authority/__init__.py index dcca399..48b7f7d 100644 --- a/authority/__init__.py +++ b/authority/__init__.py @@ -1,8 +1,8 @@ -from pkg_resources import get_distribution, DistributionNotFound +from importlib.metadata import PackageNotFoundError, version try: - __version__ = get_distribution("django-authority").version -except DistributionNotFound: + __version__ = version("django-authority") +except PackageNotFoundError: # package is not installed pass diff --git a/docs/conf.py b/docs/conf.py index 0f6c570..b0e13c7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. -from pkg_resources import get_distribution +from importlib.metadata import version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -46,7 +46,7 @@ copyright = u"2009-2020, Jannis Leidel" # built documents. # # The full version, including alpha/beta/rc tags. -release = get_distribution("django-authority").version +release = version("django-authority") # The short X.Y version. version = ".".join(release.split(".")[:2])