Skip to content

Commit

Permalink
Speed up nox docs sessions (#13118)
Browse files Browse the repository at this point in the history
* Use --jobs auto in docs nox sessions

On my 8 core system, a clean cold build takes 5-6 seconds instead of
10-11 seconds. Nothing major, but it's a welcomed QoL improvement. FYI,
this flag doesn't work and will be ignored on Windows.

* Stop installing pip twice in docs nox sessions

At some point, session.install("pip") in the docs and docs-live nox
sessions was changed to install pip in editable mode, presumably to
enable reruns w/o dependency installation (-R flag) to pick up changes
for our pip sphinx extension. This doesn't do anything though as pip
is reinstalled normally as it's declared in docs/requirements.txt.

I think it's a fair compromise that if you want to pick up changes in
pip's source that show up in the documentation, you should not be using
the -R nox flag.
  • Loading branch information
ichard26 authored Dec 22, 2024
1 parent 9626dec commit 7c218b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def test(session: nox.Session) -> None:

@nox.session
def docs(session: nox.Session) -> None:
session.install("-e", ".")
session.install("-r", REQUIREMENTS["docs"])

def get_sphinx_build_command(kind: str) -> List[str]:
Expand All @@ -143,6 +142,7 @@ def get_sphinx_build_command(kind: str) -> List[str]:
"-c", "docs/html", # see note above
"-d", "docs/build/doctrees/" + kind,
"-b", kind,
"--jobs", "auto",
"docs/" + kind,
"docs/build/" + kind,
]
Expand All @@ -154,7 +154,6 @@ def get_sphinx_build_command(kind: str) -> List[str]:

@nox.session(name="docs-live")
def docs_live(session: nox.Session) -> None:
session.install("-e", ".")
session.install("-r", REQUIREMENTS["docs"], "sphinx-autobuild")

session.run(
Expand All @@ -163,6 +162,7 @@ def docs_live(session: nox.Session) -> None:
"-b=dirhtml",
"docs/html",
"docs/build/livehtml",
"--jobs=auto",
*session.posargs,
)

Expand Down

0 comments on commit 7c218b9

Please sign in to comment.