Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autosummary generator and templates should support module data (ie fields/constants) #6794

Open
ben-spiller opened this issue Nov 4, 2019 · 1 comment
Labels
extensions:autosummary type:enhancement enhance or introduce a new feature

Comments

@ben-spiller
Copy link

Is your feature request related to a problem? Please describe.
I want to use the autosummary_generate to automatically generate rst files for a large project. Some of my modules define data constants. I'm using a customized module.rst template to get the output just the way I want, but there is no way to include the module data in the output.

Describe the solution you'd like
autosummary_generate should support module data just as it currently support module classes/exceptions/functions, i.e. by providing a "data" variable containing a list of the data items defined in this module, which could be used with autodata or similar. This would need to be added in the generate_autosummary_content function of generate.py

Maybe the default autosummary module.rst template should display data fields (just like automodule does), but that's less pressing - the most important thing is to add it to the templating so that at least people can add it themselves if needed.

Describe alternatives you've considered
I tried using "members" as a workaround (since I figured any member that's not in functions/classes/exceptions must be data) however annoyingly/surprisingly members is implemented using dir(module) rather than the get_members() function all the others use, so bypasses the normal logic for deciding about private/non-private and direct members vs imported so includes far too much junk to be useful.
https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html

I can't see any extension hooks that would enable an enduser of sphinx to add this capability without forking/changing the autosummary extension itself

Additional context
(While we're at it, a list of submodules would be really nice too)

@ben-spiller ben-spiller added the type:enhancement enhance or introduce a new feature label Nov 4, 2019
@tk0miya tk0miya added this to the 3.0.0 milestone Nov 5, 2019
@tk0miya
Copy link
Member

tk0miya commented Nov 5, 2019

+1

@tk0miya tk0miya modified the milestones: 3.0.0, 3.1.0 Mar 14, 2020
@tk0miya tk0miya modified the milestones: 3.1.0, 3.2.0 May 23, 2020
@tk0miya tk0miya modified the milestones: 3.2.0, 3.3.0 Aug 2, 2020
@tk0miya tk0miya modified the milestones: 3.3.0, 3.4.0 Oct 27, 2020
@tk0miya tk0miya modified the milestones: 3.4.0, 4.0.0 Dec 19, 2020
@tk0miya tk0miya modified the milestones: 4.0.0, 4.1.0 Mar 27, 2021
@tk0miya tk0miya modified the milestones: 4.1.0, 4.2.0 Jul 10, 2021
@tk0miya tk0miya modified the milestones: 4.2.0, 4.3.0 Sep 12, 2021
@tk0miya tk0miya modified the milestones: 4.3.0, 4.4.0 Nov 8, 2021
@tk0miya tk0miya modified the milestones: 4.4.0, 4.5.0 Jan 15, 2022
@tk0miya tk0miya modified the milestones: 4.5.0, 5.0.0 Mar 27, 2022
@tk0miya tk0miya modified the milestones: 5.0.0, 5.x May 2, 2022
@AA-Turner AA-Turner removed this from the 5.x milestone May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions:autosummary type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

3 participants