From 7c218b97a982b2bca701020cf12e861324853283 Mon Sep 17 00:00:00 2001 From: Richard Si Date: Sun, 22 Dec 2024 16:46:35 -0500 Subject: [PATCH] Speed up nox docs sessions (#13118) * 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. --- noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index 2051362769c..0d6192d1904 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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]: @@ -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, ] @@ -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( @@ -163,6 +162,7 @@ def docs_live(session: nox.Session) -> None: "-b=dirhtml", "docs/html", "docs/build/livehtml", + "--jobs=auto", *session.posargs, )