📚 Move the docs sources beside conf.py, so Read the Docs can build them - #104
Merged
Merged
Conversation
ubmarco
previously approved these changes
Sep 6, 2026
`docs/conf.py` sat next to `docs/source/**`, and the build bridged the gap with `sphinx-build ... -c docs docs/source docs/_build/html`. Read the Docs has no `-c`: it builds `sphinx.configuration`'s directory as the source directory, so it would take `docs/` -- a directory holding one `index`-less `conf.py` -- and produce nothing. This is the same finding that reshaped sphinx-mounts' docs before its import. `docs/source/*` moves up to `docs/*` with `git mv`, so `git log --follow` and `git blame` keep working, and the `-c` goes: `tox -e docs-clean` now runs `sphinx-build -nW --keep-going -b html docs docs/_build/html`, which is character for character what Read the Docs runs by itself. `gh_pages.yml` needs no change -- it uploads `docs/_build/html`, which has not moved. `conf.py` loses the `source/` prefix from `html_favicon`, `html_static_path`, `templates_path` and furo's `source_directory`. With `docs/` as the source directory, the build output and the shared `ubproject.toml` are now inside it, so `exclude_patterns` names them (the dead `templates_path = ["_templates"]` line one directive above it, overwritten further down the file, goes at the same time). `quickstart.rst`'s two `literalinclude` paths lose one `../`; they were reaching out of `docs/source/basics/` to the repository root, and without the fix `-nW` fails on them. The `docs` requirements move from a dependency group to a `docs` **extra**. Read the Docs installs extras -- `python.install`'s `extra_requirements` -- and has no way at all to install a PEP 735 group. It is also the shape a member of the sphinx-needs workspace has, where the root re-exports each member's extra. The tox docs environments follow, from `dependency_groups = docs` to `extras = docs`. `furo` stays in `testing` as well: `tests/data/sphinx/conf.py` sets `html_theme = "furo"` and `test_src_trace.py` builds that project. A `.readthedocs.yaml` comes with it, modelled on sphinx-mounts': ubuntu-24.04, python 3.13, `sphinx.configuration: docs/conf.py`, `fail_on_warning: true`, and a pip install of `.` with the `docs` extra. Its paths are relative to the repository root, and its header says so, because at import they gain a `packages/sphinx-codelinks/` prefix. No `post_checkout` job: cancelling builds for pull requests that miss the package only makes sense once several projects build out of one repository.
chrisjsewell
force-pushed
the
prep/docs-layout-rtd
branch
from
September 6, 2026 08:47
332541f to
35751b0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
=======================================
Coverage 92.91% 92.91%
=======================================
Files 44 44
Lines 3770 3770
Branches 381 381
=======================================
Hits 3503 3503
Misses 157 157
Partials 110 110 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pull Bot
pushed a commit
to twodrops/sphinx-needs
that referenced
this pull request
Sep 6, 2026
…em (useblocks/sphinx-codelinks#104) `docs/conf.py` sits next to `docs/source/**`, and the build bridges the gap with `sphinx-build … -c docs docs/source docs/_build/html`. **Read the Docs has no `-c`.** It takes the directory of `sphinx.configuration` as the source directory, so it would build `docs/` — a directory containing one `conf.py` and no `index` — and produce nothing. This is the same finding that reshaped sphinx-mounts' documentation before it was imported into the sphinx-needs repository, and it is the reason this repository cannot move off GitHub Pages as it stands. So `docs/source/*` moves up into `docs/*`, with `git mv`, so `git log --follow` and `git blame` keep working; 23 files, all recorded as renames. The `-c` goes with it: `tox -e docs-clean` now runs `sphinx-build -nW --keep-going -b html docs docs/_build/html`, which is character for character what Read the Docs runs on its own. `gh_pages.yml` is untouched — it uploads `docs/_build/html`, which has not moved — so Pages keeps working until someone chooses to turn it off. `conf.py` loses the `source/` prefix from `html_favicon`, `html_static_path`, `templates_path` and furo's `source_directory`. Because `docs/` is now the source directory, the build output and the shared `ubproject.toml` sit inside it, so `exclude_patterns` names them; the dead `templates_path = ["_templates"]` line (overwritten twelve lines further down) goes at the same time. `quickstart.rst`'s two `literalinclude` paths lose one `../` — they were climbing out of `docs/source/basics/` to the repository root, and `-nW` fails on them otherwise. **The `docs` requirements become an extra rather than a dependency group.** Read the Docs installs extras — that is what `python.install`'s `extra_requirements` is — and has no way at all to install a PEP 735 group, so requirements in a group are simply unreachable from RTD. It is also the shape a member of the sphinx-needs workspace has, where the root re-exports each member's extra. The three tox environments that used the group switch to `extras = docs`. `furo` stays in `testing` too, deliberately: `tests/data/sphinx/conf.py` sets `html_theme = "furo"` and `test_src_trace.py` builds that project. Finally, a **`.readthedocs.yaml`** at the repository root, modelled on the one sphinx-mounts carries: ubuntu-24.04, python 3.13, `fail_on_warning: true`, and a pip install of `.` with the `docs` extra. No `apt_packages` — these docs render no diagrams — and deliberately no `post_checkout` skip job, which only earns its keep once several RTD projects build out of one repository. Its header records that every path in it is relative to the repository root, so at import they each gain a `packages/sphinx-codelinks/` prefix. **How to verify** ``` tox -e docs-clean # and the RTD-shaped build, from nothing but the extra: uv venv /tmp/cl-docs && uv pip install --python /tmp/cl-docs/bin/python '.[docs]' /tmp/cl-docs/bin/sphinx-build -nW --keep-going -b html docs docs/_build/rtd git diff --stat -M # renames, not delete + add ``` Both builds are green locally (`docs-clean` 8 s; the RTD-shaped one exits 0). **Out of scope**: creating the Read the Docs project itself and pointing `codelinks.useblocks.com` at it (Chris/Marco, after the import); turning off the GitHub Pages deployment; prefixing the historical tags; removing `[dependency-groups]`, `[tool.pytest]` or `tests/__init__.py`; the PyPI trusted publisher; `release.yaml`; the pre-commit → prek switch; and any behaviour change to the extension.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/conf.pysits next todocs/source/**, and the build bridges the gap withsphinx-build … -c docs docs/source docs/_build/html. Read the Docs has no-c. It takesthe directory of
sphinx.configurationas the source directory, so it would builddocs/— adirectory containing one
conf.pyand noindex— and produce nothing. This is the samefinding that reshaped sphinx-mounts' documentation before it was imported into the sphinx-needs
repository, and it is the reason this repository cannot move off GitHub Pages as it stands.
So
docs/source/*moves up intodocs/*, withgit mv, sogit log --followandgit blamekeep working; 23 files, all recorded as renames. The
-cgoes with it:tox -e docs-cleannow runssphinx-build -nW --keep-going -b html docs docs/_build/html,which is character for character what Read the Docs runs on its own.
gh_pages.ymlis untouched— it uploads
docs/_build/html, which has not moved — so Pages keeps working until someonechooses to turn it off.
conf.pyloses thesource/prefix fromhtml_favicon,html_static_path,templates_pathand furo's
source_directory. Becausedocs/is now the source directory, the build output andthe shared
ubproject.tomlsit inside it, soexclude_patternsnames them; the deadtemplates_path = ["_templates"]line (overwritten twelve lines further down) goes at the sametime.
quickstart.rst's twoliteralincludepaths lose one../— they were climbing out ofdocs/source/basics/to the repository root, and-nWfails on them otherwise.The
docsrequirements become an extra rather than a dependency group. Read the Docsinstalls extras — that is what
python.install'sextra_requirementsis — and has no way atall to install a PEP 735 group, so requirements in a group are simply unreachable from RTD. It
is also the shape a member of the sphinx-needs workspace has, where the root re-exports each
member's extra. The three tox environments that used the group switch to
extras = docs.furostays intestingtoo, deliberately:tests/data/sphinx/conf.pysetshtml_theme = "furo"andtest_src_trace.pybuilds that project.Finally, a
.readthedocs.yamlat the repository root, modelled on the one sphinx-mountscarries: ubuntu-24.04, python 3.13,
fail_on_warning: true, and a pip install of.with thedocsextra. Noapt_packages— these docs render no diagrams — and deliberately nopost_checkoutskip job, which only earns its keep once several RTD projects build out of onerepository. Its header records that every path in it is relative to the repository root, so at
import they each gain a
packages/sphinx-codelinks/prefix.How to verify
Both builds are green locally (
docs-clean8 s; the RTD-shaped one exits 0).Out of scope: creating the Read the Docs project itself and pointing
codelinks.useblocks.comat it (Chris/Marco, after the import); turning off the GitHub Pagesdeployment; prefixing the historical tags; removing
[dependency-groups],[tool.pytest]ortests/__init__.py; the PyPI trusted publisher;release.yaml; the pre-commit → prek switch;and any behaviour change to the extension.