Skip to content

WARNING: py:class reference target not found: gi.repository... #124

Open
@ssokolow

Description

@ssokolow

While trying to get an old codebase switched over to Sphinx, I ran into a confusing problem where my Gtk.thing references were resolving but my Wnck.thing references were not, when both were set up for intersphinx equally well and both had their objects.inv generated by the same generator.

I finally tracked the problem down to referencing Gtk manually with :func: or :class: or what have you, but referencing Wnck through type annotations.

The problem being that sphinx-autodoc-typehints is trying and failing to find gi.repository.Wnck.Window in objects.inv while objects.inv contains Wnck.Window, and then producing un-linked documentation that lists the type as Window (Also not ideal. Is it Wnck.Window, Gtk.Window, Gdk.Window, or perhaps a custom class of my own?) and displaying this warning if nitpicky is set:

docstring of quicktile.commands.workspace_send_window:13: WARNING: py:class reference target not found: gi.repository.Wnck.Window

If you don't have a better idea, I'd suggest a conf.py variable something like this:

intersphinx_mapping = {
    # ...
    'wnck': ('http://lazka.github.io/pgi-docs/Wnck-3.0', None),
}

typehints_ignore_prefix = {
    'wnck': 'gi.repository.'
}

(Taking inspiration from how modindex_common_prefix works.)

For now, I've taken to doing this in my docstrings:

    :param win: The :class:`Wnck.Window` to operate on.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions