Replace hardcoded links with intersphinx refs in docs #7623
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.
This is the first part of adding referencing to
mypys docs (second part being #7624). I have configuredintersphinxand replaced hardcoded links withintersphinxreferences. IMO this has a huge benefit of maintaining links consistency: while the hardcoded link is unmanageable (for example, currently the link https://pythonhosted.org/six/#six.with_metaclass points to nowhere sincesixdocumentation has moved to https://six.readthedocs.io), theintersphinxrefs are checked implicitly - if a ref is dead, Sphinx will emit a warning when building docs1.intersphinxis an extension that is included in Sphinx by default, so no extra dependencies needed.Another advantage is the referencing simplicity: for example, instead of writing
rendered as

you do
rendered as

which is IMO a lot less work when typing and has a different style when rendered, pointing out the fact that the link leads to a library documentation.
Also, Sphinx has a
:pep:role that generates links to PEP pages, so e.g.rendered as

becomes
rendered as
1 Of course, there's the
linkcheckbuilder that checks for dead references, but it has to be run explicitly, so it's still beneficial to reduce the amount of hardcoded links to a minimum. Also,linkcheckdoesn't check for the link formatting: if one e.g. uses markdown instead of ReST to format the link, this will render wrong, butlinkcheckwon't complain.