Conversation
Currently, the methods heading is printed if there are any methods, including __init__, but __init__ is filtered out from the methods list and table. This can lead to the situation that if a class has only __init__ and no other public methods, the "Methods table" and "Methods" headings will be printed, but no actual methods will be documented. Move the methods filtering to the very beginning and overwrite the methods variable with the filtered version to prevent above problem.
With this change, one can apply autosummary to submodules of the package and have everything work.
The only difference to the default template is the addition of toctree directives for functions, classes, and exceptions. This enables one to pass a module to autosummary and have it generate documenation pages and crossreferences for all top-level functions, classes, and exceptions, not just for submodules.
|
The |
|
I did something similar here: scverse/anndata@2bd53b8 The |
print them in the first iteration
|
Done. Although I still like the previous version better: It only filtered in one place, now we have to filter in two places (methods table and methods docs). |
|
we could both re-define the variable and use the |
|
True, but then I don't really see a difference to my original approach, it's just moving the if block from outside the loop to inside the loop. |
|
Yeah, it’s just fewer |
|
If you think so. Done. |
Various fixes for the autosummary templates. In particular:
don't print Methods table heading if there are no methods
Currently, the methods heading is printed if there are any methods, including
__init__, but__init__is filtered out from the methods list and table. This can lead to the situation that if a class has only__init__and no other public methods, the "Methods table" and "Methods" headings will be printed, but no actual methods will be documented. Move the methods filtering to the very beginning and overwrite the methods variable with the filtered version to prevent above problem.use fullname instead of objname in the class template
With this change, one can apply autosummary to submodules of the package and have everything work.
add a module.rst autosummary template
The only difference to the default template is the addition of toctree directives for functions, classes, and exceptions. This enables one to pass a module to autosummary and have it generate documenation pages and crossreferences for all top-level functions, classes, and exceptions, not just for submodules.