scverse_doc.xref_overrides#

Cross-references to objects documented under another name or role.

A type annotation links to {module}.{qualname} of the object, which is often a private path like pandas.core.frame.DataFrame, while the object is documented as pandas.DataFrame. The config value xref_overrides maps one to the other:

xref_overrides = {
    "pandas.core.frame.DataFrame": "pandas.DataFrame",  # fix qualname
    "numpy.int64": ("py:data", "numpy.int64"),  # fix role
}

Keys can also be (role, name) tuples, to only override references with that role. DEFAULT_OVERRIDES are always included. Entries from conf.py that no reference needed are reported after a full build. qualname_overrides, the name in scanpydoc, still works, but is deprecated.

So that annotations from if TYPE_CHECKING: blocks also link to their full name, the imports in these blocks are executed before autodoc evaluates a signature.

scverse_doc.xref_overrides.DEFAULT_OVERRIDES: dict[str, str] = {'anndata._core.anndata.AnnData': 'anndata.AnnData', 'matplotlib.axes._axes.Axes': 'matplotlib.axes.Axes', 'pandas.core.frame.DataFrame': 'pandas.DataFrame', 'pandas.core.indexes.base.Index': 'pandas.Index'}#

Overrides included in addition to the xref_overrides from conf.py.