Create type links to other version of the standard library with Sphinx napoleon

279 Views Asked by At

I document a Python project using Sphinx and the Napoleon and the autodoc extension to parse Google style docstrings. As the Google style involves specifying the type of the arguments, Sphinx automatically creates links to the documentation of the standard types in the standard library. Intersphinx However, by default it links to the 2.7 version of the documentation, whereas I want to link to a 3.x version. How can I control this behaviour?

1

There are 1 best solutions below

0
On

How the Python library is linked is controlled by the intersphinx extension. Set

intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None)}

in conf.py and the links should link to the Python 3 standard library.

See intersphinx docs for more information on how to use intersphinx.