The Sphinx project ( http://sphinx.pocoo.org/ ) is a state of the art in the Python documentation. It is really powerful and flexible ... so also somewhat confusing. However, I think this is your best bet.
Their site has excellent documentation on how to customize the source files of the document and the process of creating them in ready-made documentation such as HTML. The part that interests you is its system for including dockers from a Python source, which I assume you did for methods that serve your REST requests. Please note that this will NOT magically interpret what is happening, but will bring all named elements and their arguments (if necessary) and provide a good basis for posting relevant documentation.
Assuming you have all the REST functions in a module named restapi.py , and it is just in your project src directory, you need to do two things to get Sphinx to automatically generate documentation:
First enable the autodoc extension and add the src directory to the Sphinx path in conf.py :
import sys, os sys.path.append(os.path.abspath('sphinxext')) extensions = ['sphinx.ext.autodoc'] sys.path.append(os.path.abspath('src'))
Then at Sphinx
.. automodule:: restapi :members:
Note: this information was taken directly from the Sphinx First Steps document with minimal reordering. Look at this document and the rest of the site if it looks like it will meet your needs.
source share