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

Add templating support to sphinx-apidoc #3545

Closed
goerz opened this issue Mar 11, 2017 · 6 comments
Closed

Add templating support to sphinx-apidoc #3545

goerz opened this issue Mar 11, 2017 · 6 comments

Comments

@goerz
Copy link
Contributor

goerz commented Mar 11, 2017

The sphinx-apidoc utility has some shortcomings, including

  • For modules with a lot of members, there is no overview of the members. The resulting page is very hard to navigate.
  • If modules expose imported objects through __all__, apidoc creates stubs for both the exporting module and the module where the object was originally defined. This leads to duplicate references. It is generally hard to control which module members will show up in the documentation
  • Apidoc produces potentially unwanted headings "Submodules", "Subpackages" and "Module contents". There is no option besides post-processing to disable these.

These and other concerns could be addressed by adding templating to the sphinx-apidoc utility. I've started to explore this option by forking the apidoc script to a tentative better-apidoc. It's a fairly small patch (I made sure to have the diff to the original apidoc.py as small as possible) that adds a-t/--templates option to the script. If this option is present, Jinja-templates module.rst and package.rst are used to render the output. See the better-apidoc README for which variables are exposed to the template and example templates. Currently, this is designed (and may further evolve) to meet my needs to document the QNET project.

I would welcome any comments and suggestions on this, especially regarding to which template variables would be useful. If there is a consensus that having template support would be useful, I would be happy to eventually prepare a pull-request to merge better-apidoc back into Sphinx (after some period of gestation).

I'm aware that sphinx-autosummary already has support for templating, so there is some overlap here. However, as far as I can tell, autosummary will generate individual files for all module members. It doesn't seem to cover the use case of having one file per module or package combining both useful summaries and the full documentation of each member.

@hanshoi
Copy link

hanshoi commented Jun 8, 2017

For me this seems like a feature well worth implementing. Keep up the good job.

@tk0miya tk0miya added this to the some future version milestone Jun 10, 2017
@tk0miya
Copy link
Member

tk0miya commented Jun 10, 2017

+1; it would be nice if somebody sends us PR!

@goerz
Copy link
Contributor Author

goerz commented Jun 10, 2017

Great, I'll work this into a pull request as soon as I have some time

@EricG-Personal
Copy link

I would love to see this implemented as well.

@goerz
Copy link
Contributor Author

goerz commented Jan 26, 2018

I will get back to this at some point, eventually..

@goerz
Copy link
Contributor Author

goerz commented Oct 24, 2019

Well, basic templating was added in v2.2, and I've decided to finish the job with #6768.

It's a further iteration on better-apidoc, in that it only keeps the central get_members function. However, this will allow to do anything that better-apidoc can currently do

@goerz goerz closed this as completed Oct 24, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
@AA-Turner AA-Turner removed this from the some future version milestone Sep 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants