Skip to content

Commit de3c23c

Browse files
docs(backport): Use importlib.metadata to get version info (#2502)
* Backport PR #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 Co-authored-by: Matthew Feickert <[email protected]>
1 parent 1dec306 commit de3c23c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
# add these directories to sys.path here. If the directory is relative to the
1616
# documentation root, use Path('../relative_path_to_dir').resolve() to make it absolute, like shown here.
1717

18+
import importlib.metadata
1819
import sys
1920
from pathlib import Path
2021

2122
import jupytext
22-
from pkg_resources import get_distribution
2323

2424
sys.path.insert(0, str(Path('./exts').resolve()))
2525

@@ -123,7 +123,7 @@ def setup(app):
123123
# |version| and |release|, also used in various other places throughout the
124124
# built documents.
125125
# The full version, including alpha/beta/rc tags.
126-
release = get_distribution('pyhf').version
126+
release = importlib.metadata.version("pyhf")
127127
# for example take major/minor/patch
128128
version = '.'.join(release.split('.')[:3])
129129

0 commit comments

Comments
 (0)