Skip to content

Commit c3c3cf3

Browse files
Use tags in docs building to split up requirements
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 the man pages (but not the HTML ones) along side the application. This is an alternative to the approach proposed in[1] and similarly addresses[2] Link: #12900 [1] Link: #12881 [2]
1 parent 8018643 commit c3c3cf3

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

docs/html/conf.py

+20-12
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,30 @@
1212
sys.path.insert(0, docs_dir)
1313

1414
# -- General configuration ------------------------------------------------------------
15-
1615
extensions = [
17-
# first-party extensions
18-
"sphinx.ext.autodoc",
19-
"sphinx.ext.todo",
20-
"sphinx.ext.extlinks",
21-
"sphinx.ext.intersphinx",
22-
# our extensions
16+
# extensions common to 'man' and 'html' builds
2317
"pip_sphinxext",
24-
# third-party extensions
25-
"myst_parser",
26-
"sphinx_copybutton",
27-
"sphinx_inline_tabs",
28-
"sphinxcontrib.towncrier",
2918
]
3019

20+
# 'tags' is a special object handled by sphinx
21+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-tags
22+
if "html" in tags: # type: ignore[name-defined] # noqa: F821
23+
# html specific deps
24+
extensions.extend(
25+
(
26+
# first-party extensions
27+
"sphinx.ext.autodoc",
28+
"sphinx.ext.todo",
29+
"sphinx.ext.extlinks",
30+
"sphinx.ext.intersphinx",
31+
# third-party extensions
32+
"myst_parser",
33+
"sphinx_copybutton",
34+
"sphinx_inline_tabs",
35+
"sphinxcontrib.towncrier",
36+
),
37+
)
38+
3139
# General information about the project.
3240
project = "pip"
3341
copyright = "The pip developers"

noxfile.py

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def get_sphinx_build_command(kind: str) -> List[str]:
146146
return [
147147
"sphinx-build",
148148
"--keep-going",
149+
"--tag",
150+
kind,
149151
"-W",
150152
"-c", "docs/html", # see note above
151153
"-d", "docs/build/doctrees/" + kind,

0 commit comments

Comments
 (0)