From 956d204eb168ed116d872f0bfed1e01140fa1473 Mon Sep 17 00:00:00 2001
From: Matthew Feickert <matthew.feickert@cern.ch>
Date: Tue, 14 May 2024 02:22:56 -0500
Subject: [PATCH] Backport PR #2477: docs: Use importlib.metadata to get
 version info

---
 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])