Skip to content

Commit 354e9d4

Browse files
Use tags in docs building to split up requirements (#13168)
The goal is to allow a build of just the `man` pages with a minimal set of dependencies, like: sphinx-build \ --tag man \ -c docs/html \ -d docs/build/doctrees/man \ -b man \ docs/man \ docs/build/man This is for the sake of people distributing `pip` who want to build exclusively the man pages (and find the HTML build dependencies problematic).
1 parent c23be8a commit 354e9d4

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

docs/html/conf.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,29 @@
1414
# -- General configuration ------------------------------------------------------------
1515

1616
extensions = [
17-
# first-party extensions
18-
"sphinx.ext.autodoc",
19-
"sphinx.ext.todo",
20-
"sphinx.ext.intersphinx",
21-
# our extensions
17+
# extensions common to all builds
2218
"pip_sphinxext",
23-
# third-party extensions
24-
"myst_parser",
25-
"sphinx_copybutton",
26-
"sphinx_inline_tabs",
27-
"sphinxcontrib.towncrier",
28-
"sphinx_issues",
2919
]
3020

21+
# 'tags' is a injected by sphinx
22+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-tags
23+
if "man" not in tags: # type: ignore[name-defined] # noqa: F821
24+
# extensions not needed for building man pages
25+
extensions.extend(
26+
(
27+
# first-party extensions
28+
"sphinx.ext.autodoc",
29+
"sphinx.ext.todo",
30+
"sphinx.ext.intersphinx",
31+
# third-party extensions
32+
"myst_parser",
33+
"sphinx_copybutton",
34+
"sphinx_inline_tabs",
35+
"sphinxcontrib.towncrier",
36+
"sphinx_issues",
37+
),
38+
)
39+
3140
# General information about the project.
3241
project = "pip"
3342
copyright = "The pip developers"

news/13168.doc.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Added support for building only the man pages with minimal dependencies using
2+
the sphinx-build ``--tag man`` option. This enables distributors to generate man
3+
pages without requiring HTML documentation dependencies.

noxfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def get_sphinx_build_command(kind: str) -> List[str]:
145145
return [
146146
"sphinx-build",
147147
"--keep-going",
148+
"--tag", kind,
148149
"-W",
149150
"-c", "docs/html", # see note above
150151
"-d", "docs/build/doctrees/" + kind,

0 commit comments

Comments
 (0)