From: Stefano Rivera <stefanor@debian.org>
Date: Sun, 8 Nov 2026 16:16:04 +0000
Subject: Sphinx: Determine version from Debian changelog

We're building the docs against the source package, without distribution
metadata.
---
 docs/conf.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index eba1ebf..53dec70 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -8,7 +8,7 @@ import os
 import sys
 from datetime import UTC, datetime
 from html import escape as html_escape
-from importlib.metadata import version as distribution_version
+from subprocess import check_output
 from pathlib import Path
 from typing import TYPE_CHECKING, Any, Final
 from urllib.parse import urlsplit
@@ -26,7 +26,11 @@ sys.path.insert(0, str(Path(__file__).parent / "_ext"))
 project = "pipx"
 author = "pipx contributors"
 project_copyright = f"{datetime.now(tz=UTC):%Y}, pipx contributors"
-release = distribution_version("pipx")
+release = check_output(
+    ("dpkg-parsechangelog", "-Sversion"),
+    cwd=Path(__file__).parent.parent,
+    encoding="ASCII"
+).strip()
 version = ".".join(release.split(".")[:2])
 
 # Recipes across the how-to guides share one implicit import, so set it up once for every doctest group.
