Skip to content

Sphinx linkcheck and broken/redirect occurrences in Python Docs #103484

Open
@rffontenelle

Description

@rffontenelle

Running make linkcheck in Doc folder outputs thousands of broken and redirected status. It would be nice to clean this up so we can link-check Python in CI/CD for each commit, but right now it is too polluted.

Some of these occurrences could/should be fixed in the docs itself, others can benefit from Sphinx's linkcheck configs e.g. linkcheck_ignore and linkcheck_allow_redirect.

See linkcheck-log.txt for the full log as of commit f2b7ecb.

Fun stats obtained from the above file:

  • Of its 8327 lines, where 7824 are related to BPO -> GH issues. Of 7824, 5744 lines are from whatsnew/changelog and only 20 are not from whatsnew/
  • 241 lines are redirection of CPython CVS URL, fixing /tree/ to /blob/ in GitHub URL
  • 28 lines are broken links, where one broken link is 'https://' from an example in whatsnet/changelog

The way I see, this steps divide in:

  • Clean BPO to GH redirection messages
  • Fix broken links
  • Clean CPython CVS URL redirections
  • Clean GH issues to GH PR redirections
  • Fix the rest of the occurrences.

linkcheck_allow_redirect and linkcheck_ignore can be very handy in this case. linkcheck_allow_redirect makes 'ok' status a redirect that is being spotted by linkcheck, and we have linkcheck_ignore as the last resource.

Questions I have before implementing the solution:

  • Documentation hosted by Read The Docs may have language enabled so example.com is redirected to example.com/en/latest. To handle occurrences, I could add them to linkcheck_allow_redirect or we can use sphinx-ext-intersphinx to map a keyword to the documentation URL (e.g 'rtd' for read-the-docs docs). The last option allows to map to proper language of the target URL linked, similar on how Weblate did)
  • Is there any restrictions to fix broken/redirect links in old whatsnew/.rst?
  • Is there any restrictions to fix broken/redirect links in old whatsnew/changelog.rst (i.e. Misc/NEWS)?
  • Should I create a single Pull Request for all the fixes?

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions