disnake icon indicating copy to clipboard operation
disnake copied to clipboard

docs: update build for new readthedocs addons

Open shiftinv opened this issue 1 year ago • 0 comments

Summary

See https://about.readthedocs.com/blog/2024/07/addons-by-default/.

There are technically two separate things going on, although the blog post really only highlights the first one: tl;dr: many words, few changes, some unknowns.


1. readthedocs addons

(Re-)Implements the bottom-right flyout menu, plus a couple other things. See the repo and blog post.

  • Aims to be a replacement of the readthedocs-sphinx-ext extension that RTD injects into all projects[^1] at build-time; the extension is being deprecated
  • This is implemented at request-time (by inserting the addons script tag in a worker), not at build-time

There aren't many changes for us here in practice; compared to the build-time extension, mainly a couple minor visual updates of the flyout menu and version warning banners. This now also leaves sphinx' search feature alone and doesn't patch it to use RTD's API, so manually setting docsearch_disabled on our end isn't required anymore.

Timeline

Can be enabled/disabled via a toggle in the dashboard, will be enabled for everyone in October.


2. conf.py changes

Previously, RTD would append a bunch of stuff to docs/conf.py at build time, which was rather annoying sometimes.

  • This inserted said extension, set html_baseurl, and inserted a bunch of values into the html_context for templates

Not many changes here either; we already set html_baseurl, and the only context value used in templates was READTHEDOCS, which I've added again.

Timeline

Not entirely clear atp. This can't be toggled via the dashboard, and will just happen at some point. From a couple comments I've read, this is slated to be applied to new projects in ~two weeks, and will be enabled for everyone in October as well, but is still technically independent of the addons rollout.


Issues

  1. readthedocs addons
    • The version warning banner behavior has changed slightly. It now shows a "development version" banner on latest, which I think is fine. It also shows an "old version" banner on all non-stable versions, which includes e.g. v2.9.2. This doesn't make sense if it's the latest semver version, since it's equivalent to stable.
    • The new flyout currently doesn't have the On GitHub link to the current document, due to https://github.com/readthedocs/readthedocs.org/blob/bf023534b0a49aca1e0336ffb077ace502fc5b63/readthedocs/proxito/views/hosting.py#L429.
  2. conf.py changes
    • It's not clear how readthedocs plans to support htmlzip without build-time context injection. Simulating the new behavior results in broken htmlzip builds (since their builder calls something implemented by the extension, which isn't being added anymore with this), but ultimately that's up to them to fix.
      • update: assuming this to be fixed as of https://github.com/readthedocs/readthedocs.org/commit/d2817011295b9501fa2960179497c5640e90571b

Checklist

  • [ ] If code changes were made, then they have been tested
    • [ ] I have updated the documentation to reflect the changes
    • [ ] I have formatted the code properly by running pdm lint
    • [ ] I have type-checked the code by running pdm pyright
  • [ ] This PR fixes an issue
  • [ ] This PR adds something new (e.g. new method or parameters)
  • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • [x] This PR is not a code change (e.g. documentation, README, ...)

[^1]: except those using a custom build.commands config

shiftinv avatar Jul 18 '24 19:07 shiftinv