Broken autosummary links

21 views
Skip to first unread message

F H

unread,
Apr 14, 2020, 5:03:50 AM4/14/20
to sphinx-users
Hi,

I am documenting some Python code with autodoc and autosummary. My rst-files are being parsed into HTML without any errors or warnings, but in most instances the links generated by the autosummary tables are broken (i.e. they do not link to the full definition).

I am not using automodule to document the members of a module, but the respective directives for each member separately. But I would like to include the module docstring and invoke for that the automodule directive without any further arguments. This invocation seems to be the culprit for causing the broken links, but only for sub-modules, not for the package module. As two minified examples:

The file for my package module, the links generated by the autosummary directives do work here:

some_package
============

.. automodule:: some_package

.. rubric:: Numeric Constants
.. autosummary::
    :nosignatures:

    some_package.some_numeric_constant

.. rubric:: Type Constants
.. autosummary::
    :nosignatures:

    some_package.some_type_constant

.. rubric:: Functions
.. autosummary::
    :nosignatures:

    some_package.some_function

Numeric Constants
-----------------
.. autodata:: some_package.some_numeric_constant

Type Constants
--------------
.. autodata:: some_package.some_type_constant

Functions
---------
.. autofunction:: some_package.some_function

And here the file for a sub-module of that package, the links only work, when I remove the automodule:: some_package.a_module directive.

some_package.a_module
=====================

.. toctree::
    :hidden:
    
    some_class_page

.. automodule:: some_package.a_module

.. note::
    A note that contains a reference to the module itself :mod:`some_package.a_module`.
    
.. rubric:: Classes

.. autosummary::
    :nosignatures:

    some_package.a_module.SomeClass

.. rubric:: Functions
.. autosummary::
    :nosignatures:

    some_package.a_module.some_function

Functions
---------
.. autofunction:: some_package.a_module.some_function

So, I assume the automodule directive does claim (for the lack of a better word) the domain of my module. Is there a way to make it behave similar to py::currentmodule? Any why is it working in my package module?

Cheers and thanks for the help,
Ferdinand 

Komiya Takeshi

unread,
Apr 17, 2020, 11:11:07 AM4/17/20
to sphinx...@googlegroups.com
Hi,

I think you need to use `:toctree:` option to generate contents from
docstring automatically. But it is a bit complex usage. So please read
the document of autosummary.

Thanks,
Takeshi KOMIYA

2020年4月14日(火) 18:03 F H <bee...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/98a000da-d14d-4c7d-b1b9-27327ad92180%40googlegroups.com.

F H

unread,
Apr 17, 2020, 2:01:57 PM4/17/20
to sphinx-users
Hi,

Thank you for your answer. I took a look at the docs and I am not sure that the :toctree: option of the autosummary directive does solve anything, since I neither want my members to appear in the toctree nor do I want to generate any stubs. Frankly this looks pretty much like a bug to me, since removing the automodule directive without any documented members (to just include the module doc string) fixes everything. I do not have that many modules, so I will just manually add the module doc string and just open a bug report on github.

Cheers,
Ferdinand
Reply all
Reply to author
Forward
0 new messages