You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sphinx autosummary modules should return module names without path #9743
Is your feature request related to a problem? Please describe.
We are using sphinx.ext.autosummary with _templates to create new files for each class, attribute, function.
This works perfectly for the above mentioned, where the template file contains (e.g. just for classes):
{% if classes %}
.. automodule:: {{ fullname }}
.. currentmodule:: {{ fullname }}
.. rubric:: Classes
.. autosummary::
:toctree::nosignatures:
{% for class in classes %}
{{ class }}
{% endfor %}
{% endif %}
Note that we are setting with .. currentmodule:: {{ fullname }} the correct path to the current file and then document each class with: {% for class in classes %}. This works, because classes returns the class names without prefix (the path contained in fullname).
For modules, on the other hand, the approach doesn't work:
I think #6792 should raise the priority of this, because now Sphinx will reject the full path modules with an error. We had to work around this by doing:
Activity
JPEWdev commentedon Jul 15, 2024
I think #6792 should raise the priority of this, because now Sphinx will reject the full path modules with an error. We had to work around this by doing:
{% if modules %} .. rubric:: Modules .. autosummary:: :toctree: :template: module-template.rst :recursive: {% for item in modules %} {{ item | replace(fullname + ".", "") }} {%- endfor %} {% endif %}AA-Turner commentedon Jul 17, 2024
Please see #12609, which ought resolve this.
A
AA-Turner commentedon Jul 18, 2024
I have released Sphinx 7.4.6 with a fix.
A