From ecd06135a9d59fa66dcbbc5537bba65661108a87 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Tue, 14 May 2024 02:22:56 -0500 Subject: [PATCH] docs: Use importlib.metadata to get version info (#2477) * pkg_resources is deprecated as an API, so stop using it. - c.f. https://setuptools.pypa.io/en/latest/pkg_resources.html * importlib.metadata.version is the recommended way to get package version information. - c.f. https://docs.python.org/3/library/importlib.metadata.html --- docs/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 60ab7b974d..132f4da544 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,11 +15,11 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use Path('../relative_path_to_dir').resolve() to make it absolute, like shown here. +import importlib.metadata import sys from pathlib import Path import jupytext -from pkg_resources import get_distribution sys.path.insert(0, str(Path('./exts').resolve())) @@ -123,7 +123,7 @@ def setup(app): # |version| and |release|, also used in various other places throughout the # built documents. # The full version, including alpha/beta/rc tags. -release = get_distribution('pyhf').version +release = importlib.metadata.version("pyhf") # for example take major/minor/patch version = '.'.join(release.split('.')[:3])