diff --git a/docs/conf.py b/docs/conf.py index ae7b84a2d..1c0837497 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,7 @@ import os import sys -from pkg_resources import get_distribution +from importlib import metadata # 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 @@ -48,7 +48,7 @@ # |version| and |release|, also used in various other places throughout the # built documents. # -release = get_distribution("django-simple-history").version +release = metadata.version("django-simple-history") # for example take major/minor version = ".".join(release.split(".")[:2]) diff --git a/simple_history/__init__.py b/simple_history/__init__.py index e3e1ca7d0..024d89181 100644 --- a/simple_history/__init__.py +++ b/simple_history/__init__.py @@ -1,8 +1,8 @@ -from pkg_resources import DistributionNotFound, get_distribution +from importlib import metadata try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: + __version__ = metadata.version(__name__) +except metadata.PackageNotFoundError: # package is not installed pass