Skip to content

Put qualname in the objects.inv #4826

Closed
@flying-sheep

Description

@flying-sheep

Due to type annotations, more and more tools retrieve qualified object names from live objects and expect them to serve as object ID.

However, code like the following fails when the object is reexported, when its canonical location doesn’t fit its qualified name:

from scipy.sparse import spmatrix

qualname = f'{spmatrix.__module__}.{spmatrix.__qualname__}'  # 'scipy.sparse.base.spmatrix'


from sphinx.ext.intersphinx import inspect_main

sys.stdout = StringIO()
inspect_main(['https://docs.scipy.org/doc/scipy/reference/objects.inv'])

assert qualname in sys.stdout.getvalue()  # nope, only 'scipy.sparse.spmatrix'

a fix could either go into the inventory dumping or the python domain (if adding objects goes through a domain API and isn’t just doing env.domains['py'].objects.append(…))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions