diff --git a/docs/source/conf.py b/docs/source/conf.py index 8bca8e3a075..0ceb7346bd1 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -192,3 +192,16 @@ # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True + +# -- Type hints configs ------------------------------------------------------ + +autodoc_typehints = "signature" + +# -- A patch that turns-off cross refs for type annotations ------------------ + +import sphinx.domains.python +from docutils import nodes +from sphinx import addnodes + +# replaces pending_xref node with desc_type for type annotations +sphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type("", nodes.Text(t))