#37157 closed Cleanup/optimization (fixed)
Document how sphinx-autobuild can be used for nicer, faster, and better doc writing process
| Reported by: | Mike Edmunds | Owned by: | SnippyCodes |
|---|---|---|---|
| Component: | Documentation | Version: | 6.0 |
| Severity: | Normal | Keywords: | sphinx |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
CPython's docs Makefile includes an htmllive target that's extremely helpful while working on docs. It:
- Builds the docs
- Opens a web browser on the local docs build (like Django's "make htmlview")
- Watches the docs source and rebuilds after any changes
- Hot reloads updated pages
All of this is via sphinx-autobuild.
We should borrow that "htmllive" target for Django's docs/Makefile.
(I haven't investigated whether sphinx-autobuild works on Windows. If so, we'd also add it in docs/make.bat.)
Change History (12)
comment:1 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
comment:2 by , 3 weeks ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
comment:3 by , 3 weeks ago
Thank you Mike. I've been using forever SPHINXOPTS="--port 5555" SPHINXBUILD=sphinx-autobuild make html (just because I want my docs in the 5555 port). In all honesty, I'm not sure we should add this one to the Makefile. It requires a new dependency and we are very careful about declaring new dependencies in the project.
I wouldn't object to documenting this nicety, though, in the "writing docs" section. I could accept on that premise, otherwise this is a (friendly) wontfix from my POV.
comment:4 by , 3 weeks ago
Yeah, I think this would be better as a tip in the docs.
(Can't believe I've been maintaining docs in Sphinx for ~15 years and am just now learning of sphinx-autobuild 🤯)
comment:6 by , 3 weeks ago
| Summary: | Add "htmllive" for docs development (sphinx-autobuild) → Document how sphinx-autobuild can be used for nicer, faster, and better doc writing process |
|---|
comment:7 by , 3 weeks ago
| Has patch: | set |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:8 by , 3 weeks ago
| Patch needs improvement: | set |
|---|
comment:9 by , 2 weeks ago
| Patch needs improvement: | unset |
|---|
comment:10 by , 2 weeks ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note that sphinx-autobuild can be used with the existing docs/Makefile by setting a few variables:
You can substitute
make htmlor any other html-like target. SetSPHINXOPTS='--open-browser --delay 0'if you want the browser to open faster.Something similar should work on Windows with docs/make.bat, which supports the same variables. (Command syntax is left as an exercise for the reader.)
Although "htmllive" and "dirhtmllive" Makefile targets would be nice, that does add a docs dependency on sphinx-autobuild. (Or starts us down the path of installing dependencies on demand, which is what CPython's Makefile does.) We might prefer to just mention using sphinx-autobuild as a tip in the contributor docs.