I've got sphinx autodoc working with sphinx-autodoc-typehints and intersphinx such that :class:
references render links when used in docstrings. Function parameter types also render type links for std library types.
My problem is that my custom types, and those in other dependent libraries, do not correctly render in the function type documentation.
Example:
from typing import Optional
from mylib import MyClass
function my_func(mc: MyClass, should_do_something: Optional[bool]):
"""
Takes a :class:`mylib.MyClass` and does something if should_do_something is True.
:param mc: A very important value, regarding
:class:`mylib.MyClass` and :class:`mongoengine.queryset.QuerySet`
:param should_do_something: Whether or not it should.
"""
pass
In the above example, nearly all of the type references render as links, including links to external rtd sites. The function parameter types render links to the Optional
and bool
types on python.org.
But the parameter types referencing my own types only render in red text with no link.
Given that manual references work elsewhere in my docs, and even in the :param: docstrings, I feel sure they are wired in correctly.
Is there something I need to know about sphinx extension load ordering? I don't get any errors from Sphinx, either.
In the image below, you can see most of the parameter types render blue links, but the mongoengine QuerySet parameter, and the ones from my own library, are missing. Why would this be?
tag is not wrapped inside of an tag. – Tyler Gannon Nov 07 '20 at 06:55