docs(rtd): native version selector for exact releases - #597
Merged
Merged
Conversation
Read the Docs Addons already fill the sphinx_rtd_theme (3.0) sidebar version <select> and the RTD flyout from the RTD API with every active version, so the repo never lists versions. This change wires the theme integration explicitly and keeps the page when switching: - conf.py: drop the removed `display_version` theme option (3.0 warns on it), enable `version_selector`, hide the theme's duplicate flyout, set `html_baseurl` from READTHEDOCS_CANONICAL_URL and `html_context["READTHEDOCS"]` as the RTD docs now require, and load js/version_switch.js. - _static/js/version_switch.js: rewrite the sidebar options to the same page in the chosen version (version root + the readthedocs-resolver-filename meta), the rule RTD's own flyout uses; no-op outside RTD. - layout.html dev banner and the Citation section point readers at the selector and the immutable /en/vX.Y.Z/ URLs. - .readthedocs.yaml / CONTRIBUTING: document the one-time RTD dashboard setup (activate v1.0.0 .. v1.1.0, automation rule ^v\d+\.\d+\.\d+$ -> Activate, default version stable) and the release-step check. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #597 +/- ##
=======================================
Coverage 95.39% 95.39%
=======================================
Files 222 222
Lines 23387 23387
Branches 4073 4073
=======================================
Hits 22309 22309
Misses 631 631
Partials 447 447
🚀 New features to boost your workflow:
|
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.
Summary
Users can now switch between documentation for exact AAanalysis releases (
v1.0.0,v1.0.1, ...,v1.1.0) as well aslatestandstable, using the native Read the Docs version selector. Nothing in the repository lists versions: the sphinx_rtd_theme (3.0) sidebar dropdown and the Read the Docs flyout are filled at page-load time from the Read the Docs Addons API with every active version, so future tags need no source edit.URLs follow the standard layout:
https://aaanalysis.readthedocs.io/en/latest/(master, development)https://aaanalysis.readthedocs.io/en/stable/(highest active release tag)https://aaanalysis.readthedocs.io/en/v1.0.0/(exactly the v1.0.0 tag, immutable)Changes
docs/source/conf.py: drop the removeddisplay_versiontheme option (sphinx_rtd_theme 3.0 warns on it), enableversion_selector, hide the theme's duplicate flyout, sethtml_baseurlfromREADTHEDOCS_CANONICAL_URLandhtml_context["READTHEDOCS"]as the Read the Docs docs now require, and loadjs/version_switch.js.docs/source/_static/js/version_switch.js(new): the theme links every dropdown option to the version root; this rewrites the options to the same page in the chosen version (version root + thereadthedocs-resolver-filenamemeta tag), the rule Read the Docs' own flyout uses. A page that does not exist in the target version falls through to Read the Docs' 404 for that version. No-op outside Read the Docs._templates/layout.html) and the Citation section on the landing page point readers at the selector and the immutable/en/vX.Y.Z/URLs..readthedocs.yamlcomments and the CONTRIBUTING release step document the dashboard setup and the post-release check.Verified with a local Sphinx build under the Read the Docs environment variables: no theme-option warning, the addons meta tag, the sidebar
version-switchcontainer, the script and the canonical link are all rendered.Git tags
v1.0.1andv1.0.2had no git tag, so Read the Docs could not build them. Annotated tags were created at the release commits (matched to the PyPI upload dates) and pushed:Required Read the Docs dashboard configuration (one-time, cannot be set from the repo)
At https://app.readthedocs.org/dashboard/aaanalysis/ :
v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0. Each activation builds that tag's own commit once; the result never changes afterwards.^v\d+\.\d+\.\d+$, version type Tag, action Activate version. Future release tags then appear in the selector automatically. Optionally a second rule with the same match and Set version as default.stable(notlatest), Default branchmaster.Note: a tag is built from its own commit, so a tag whose docs build fails on today's builders cannot be repaired from
master.v1.0.0builds with its 2024 configuration (ubuntu-20.04, Python 3.9, Sphinx 5.3 pins);v1.0.1onward pin Sphinx 8.1.Acceptance criteria
latestandstableremain availablev1.0.0selectable, leading to/en/v1.0.0/(after dashboard activation).readthedocs.yaml🤖 Generated with Claude Code