[Python] Sphinx viewcode does not work for inherited members

Discussão em 'Python' iniciado por Stack, Fevereiro 16, 2025.

  1. Stack

    Stack Membro Participativo

    Trying to document the inherited members (mixins) of my Python class with Sphinx.

    I've got the following in conf.py:

    extensions = ["sphinx.ext.viewcode", "sphinx.ext.autodoc"]


    and the following in index.rst:

    .. autoclass:: My_Module.My_Class
    :show-inheritance: True
    :inherited-members: True
    :private-members:


    The functions directly defined in my class have the [source] link available.

    Those inherited functions do not have the [source] link available.

    If I create an automodule of the inherited class within index.rst, the [source] link does show up, but I don't want 2 copies of the inherited functions.

    After a few hours of searching, I figured I'd ask you folks. I'm stumped.

    Can you help me figure out how to get the source links to the inherited functions?

    Continue reading...

Compartilhe esta Página