diff --git a/docs/html/conf.py b/docs/html/conf.py
index be95eca2941..0c390c9245a 100644
--- a/docs/html/conf.py
+++ b/docs/html/conf.py
@@ -14,20 +14,29 @@
# -- General configuration ------------------------------------------------------------
extensions = [
- # first-party extensions
- "sphinx.ext.autodoc",
- "sphinx.ext.todo",
- "sphinx.ext.intersphinx",
- # our extensions
+ # extensions common to all builds
"pip_sphinxext",
- # third-party extensions
- "myst_parser",
- "sphinx_copybutton",
- "sphinx_inline_tabs",
- "sphinxcontrib.towncrier",
- "sphinx_issues",
]
+# 'tags' is a injected by sphinx
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-tags
+if "man" not in tags: # type: ignore[name-defined] # noqa: F821
+ # extensions not needed for building man pages
+ extensions.extend(
+ (
+ # first-party extensions
+ "sphinx.ext.autodoc",
+ "sphinx.ext.todo",
+ "sphinx.ext.intersphinx",
+ # third-party extensions
+ "myst_parser",
+ "sphinx_copybutton",
+ "sphinx_inline_tabs",
+ "sphinxcontrib.towncrier",
+ "sphinx_issues",
+ ),
+ )
+
# General information about the project.
project = "pip"
copyright = "The pip developers"
diff --git a/news/13168.doc.rst b/news/13168.doc.rst
new file mode 100644
index 00000000000..7681e00fcdb
--- /dev/null
+++ b/news/13168.doc.rst
@@ -0,0 +1,3 @@
+Added support for building only the man pages with minimal dependencies using
+the sphinx-build ``--tag man`` option. This enables distributors to generate man
+pages without requiring HTML documentation dependencies.
diff --git a/noxfile.py b/noxfile.py
index d37c9a94766..2484af5ff49 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -145,6 +145,7 @@ def get_sphinx_build_command(kind: str) -> List[str]:
return [
"sphinx-build",
"--keep-going",
+ "--tag", kind,
"-W",
"-c", "docs/html", # see note above
"-d", "docs/build/doctrees/" + kind,