Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate one page per module with sphinx

We are using Sphinx to generate our Python documentation.

This is the command line we use:

sphinx-apidoc -F -o %WORKSPACE%\docs_rst %PACKAGE%

sphinx-build -b html %WORKSPACE%\docs_rst %WORKSPACE%\docs

The problem is that we get one page per package. What we would really need though is one page per module as the page gets way too long otherwise.

How would I set this up please?

like image 434
Patrick Wolf Avatar asked Jul 25 '12 05:07

Patrick Wolf


People also ask

What is Intersphinx?

New in version 0.5. This extension can generate links to the documentation of objects in external projects, either explicitly through the external role, or as a fallback resolution for any other cross-reference.

What is Sphinx AutoAPI?

Sphinx AutoAPI provides "autodoc" style documentation for multiple programming languages without needing to load, run, or import the project being documented. In contrast to the traditional Sphinx autodoc, which is Python-only and uses code imports, AutoAPI finds and generates documentation by parsing source code.


2 Answers

I have submitted a patch to Sphinx to do exactly what you are asking for -- it adds a commandline option to apidoc that will put each module on its own page.

Patch can be viewed here: https://bitbucket.org/birkenfeld/sphinx/pull-request/161/added-option-to-apidoc-to-write-each

It's currently pending a merge into Sphinx, the command will add a separate tag that will work thusly:

sphinx-apidoc -o [output_dir] [package_dir] --separate

like image 117
JesseReichler Avatar answered Oct 06 '22 23:10

JesseReichler


You might be able to do something like this using the autosummary extension and the sphinx-autogen script (possibly using custom templates).

like image 23
Kevin Horn Avatar answered Oct 07 '22 01:10

Kevin Horn