Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock docs dependencies; build docs with recent Sphinx version #938

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

benhoyt
Copy link
Collaborator

@benhoyt benhoyt commented May 31, 2023

I noticed that my local build of the docs was significantly different from the ReadTheDocs one, so I wanted to get them in sync. The Sphinx version RTD was using was really old, 1.8.6. Now we're relatively up to do on 6.2.1 (we can't go to 7.x yet as the sphinx_rtd_theme theme doesn't yet support 7.x).

Using a recent Sphinx produces somewhat nicer docs, particularly in terms of type annotations. Things like Optional[Union[Foo, Bar]] become Foo | Bar | None -- much lighter on the eyes. You can view the updated docs here.

Per https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html, this updates the .readthedocs.yaml config for the latest format, pins the dependency versions (transitively).

To do the transitive pinning, use a requirements.in (which should be updated by hand) that generates a fully-pinned requirements.txt (which shouldn't be edited). Added the docs/update_requirements.sh script to do this.

Now that we're on a recent Sphinx version, we need to use autodoc_typehints='signature' to avoid the extra empty "Parameters" sections on all classes.

I noticed that my local build of the docs was significantly different
from the ReadTheDocs one, so I wanted to get them in sync.

Per https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html,
this updates the .readthedocs.yaml config for the latest format, pins
the dependency versions (transitively).

To do the transitive pinning, use a requirements.in (which should be
updated by hand) that generates a fully-pinned requirements.txt (which
shouldn't be edited). Added the docs/update_requirements.sh script to
do this.

Now that we're on a recent Sphinx version, we need to use
autodoc_typehints='signature' to avoid the extra empty "Parameters"
sections on all classes.
@benhoyt benhoyt requested a review from jnsgruk May 31, 2023 05:20
@jnsgruk
Copy link
Member

jnsgruk commented May 31, 2023

@evildmp i wonder if the Canonical/Ubuntu theme could be used here?

@jnsgruk
Copy link
Member

jnsgruk commented May 31, 2023

(And thanks, Ben! This looks much nicer!)

@benhoyt
Copy link
Collaborator Author

benhoyt commented Jun 1, 2023

Going to merge this without further review. This is purely a docs improvement, and we can always address the issue of a Canonical theme in a future PR (is a Sphinx theme something we have lying around?).

@benhoyt benhoyt merged commit 74e7a5c into canonical:main Jun 1, 2023
@benhoyt benhoyt deleted the lock-docs branch June 1, 2023 01:21
@benhoyt benhoyt mentioned this pull request Jun 1, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants