Improve speed of the docs build
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 53/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- documentation, performance
Research direction
Start with the profiling results and implementation context in #1204, then inspect prep_docs.py and the Sphinx configuration for the build steps listed here. The issue proposes several separate optimizations, including reusing pydeps analysis, caching notebook execution, and parallelizing the gallery; choose a scoped task and check its behavior in CI. Done means the chosen change measurably reduces build time and the documentation build still succeeds.
Written by the indexing model from the issue text.
Description
🧰 Task
Using @Schefflera-Arboricola 's https://github.com/Schefflera-Arboricola/sphinx-benchmark?rgh-link-date=2026-11-06T20%3A35%3A15Z I worked on profiling our docs build (see also pydata/xarray#11800 and the
Quansight post) -- see #1204 for implementation. Here is the results, summarized, and I see a few places we can try to tackle, especially the mermaid diagrams built in prep_docs (I thougth there is an issue for this but Ican't find)
Where the docs build spends its time, and ideas to speed it up
See #1204 for the setup that I used, including using local instead of remote napari. (See also #1203 for some broken quirks I found on Windows while Iw as doing this, like notebook hangs and such.)
Time
| Step | Time | Notes |
|---|---|---|
prep_docs.py: UI architecture sections |
~420 s | 7 sections × 53–76 s; pydeps re-analyses the napari import graph for each one. Runs before Sphinx starts. |
| Gallery (sphinx-gallery) | ~220 s | 118 examples, 183 s executing. Evenly spread; the slowest is 12.5 s. |
| Notebook execution (myst-nb) | ~150 s | 16 notebooks, re-executed on every build. open_images 32 s, viewer 15 s, the rest 4–10 s each. |
| The rest of Sphinx | ~75 s | Writing HTML ~25 s, autodoc ~15 s, parsing ~8 s. |
Ideas
- UI sections (~420 s): run the pydeps module analysis once and reuse it
for all 7 sections, or at least run the sections in parallel. Caching
the output per napari commit would help repeat local builds. - Notebooks (~150 s): enable myst-nb's jupyter-cache
(nb_execution_mode = "cache"), so unchanged notebooks are skipped on
repeat builds. Possibly persist the cache in CI. - Look at
open_images(32 s): likely data download or loading slowing this down a lot, and it also flakes on CI frequently so good to revisit - Gallery (~220 s): try sphinx-gallery's
paralleloption. This is probably
risky with Qt, but things are more stable on Qt6 now; it needs testing on CI especially. - Add profiling tasks so this is easy to repeat: #1204 .
Notes on the tooling
- sphinx-benchmark forces a serial build (it isn't parallel-safe), so compare
shares, not wall-clock. - It doesn't see
prep_docs.py, which runs before Sphinx. Those times come from
the script's own "completed in" output.
- Dominant language
- Makefile
- Stars
- 13
- Forks
- 71
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 31
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from napari/docs
-
Link Checker ReportPossibly taken @rezamuliawijaya claimed this today. Openmaintenance task
Difficulty 1/5 1-3 hours Newbie friendliness 75/100
napari/docs#1201 · 1 comment ·
Maintainers usually reply within 2 days
-
task
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
napari/docs#1152 · 3 comments ·
Maintainers usually reply within 2 days
-
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
napari/docs#653 · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 57/100
napari/docs#1186 · 1 reaction ·
Maintainers usually reply within 2 days
Similar issues
-
customer-reported question
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Azure/azure-rest-api-specs#48017 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
Azure/azure-sdk-for-net#64658 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
documentation good first issue priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
TMHSDigital/Free-Game-Dev-Assets#270 ·
Maintainers usually reply within 1 day
-
documentation good first issue
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
btclib-org/btclib-ecc#476 ·