Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions docs/html/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurred to me that maybe if the extension loading was to be moved to the setup() entry point, the builder name would already be known by then and so this might not even have to use tags but would rely on the requested builders.

Another approach I used in the past, in a little different context, was scanning for the builder args in sys.argv: sphinx-contrib/spelling#55 (comment) / cherrypy/cheroot@63097fb#diff-85933aa74a2d66c3e4dcdf7a9ad8397f5a7971080d34ef1108296a7c6b69e7e3R12-R15.

(
# 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"
Expand Down
3 changes: 3 additions & 0 deletions news/13168.doc.rst
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down