Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emit reStructuredText from sphinx autodoc?

Tags:

CPython doesn't use autodoc for its documentation - we use hand-written prose.

For PEP 3144 (the ipaddress module), I'd like to use sphinx-apidoc to generate the initial reference documentation. That means I want to run a two-pass operation:

  1. Use sphinx-apidoc to emit a Sphinx project for the module that depends on autodoc

  2. Run a sphinx builder that creates new reStructuredText source files, with all the autodoc directives replaced by inline reStructuredText content and markup that produces the same output

The first step is straightforward, but I have no idea how to do the second step and can't even think of good ways to search for any existing projects along these lines.

like image 384
ncoghlan Avatar asked Apr 30 '12 01:04

ncoghlan


People also ask

How does Sphinx Autodoc work?

autodoc provides several directives that are versions of the usual py:module , py:class and so forth. On parsing time, they import the corresponding module and extract the docstring of the given objects, inserting them into the page source under a suitable py:module , py:class etc. directive.


1 Answers

I had same problem and for one time generating of docs I've used quite ugly solution to patch Sphinx, see Make Sphinx generate RST class documentation from pydoc.

like image 188
Michal Čihař Avatar answered Nov 08 '22 18:11

Michal Čihař