How do I export all the Python docs of a package and get it into Devhelp?

At the moment, to read the documentation of a package, quickly for examle, I do this:

>>> import quickly
>>> help(quickly)
 
>>> import quickly.widgets
>>> help(quickly.widgets)
 
>>> import quickly.widgets.text_editor
>>> help(quickly.widgets.text_editor)
 

and so on...

This is obviously very tedious. How can I export all of the quickly documentation, including all sub-packages, then get it to show up in the devhelp documentation browser?

Exporting the documentation as HTML would be nice too. I would even be happy if some version of it existed on the web, but I can't seem to find one.

Note: By package I mean a alt text python-package, not a .deb package.


Solution 1:

You can create HTML documentation of a python module using epydoc Install epydoc.

Epydoc is a tool for generating API documentation for Python modules, based on their docstrings.

Here is how to use epydoc to create HTML documentation for the module quickly.widgets:

epydoc --html quickly.widgets -o quickly_widgets_doc

Once this finishes, open up quickly_widgets_doc/index.html in your web browser:

alt text

Or, if you would prefer this documentation in a PDF:

epydoc --pdf quickly.widgets --name "quickly.widgets" -o quickly_widgets_doc_pdf

This creates the file quickly_widgets_doc_pdf/api.pdf

alt text

More information on using epydoc here.

I haven't found a way to convert these to a format DevHelp can use, if I do I'll edit this answer.

Solution 2:

I little known "secret" is the pydoc tool that is included with every Python installation (so no need to install extra packages).

Start a webserver that generates instant documentation from the source (using the same techniques as help() in the Python console) that listens on http://localhost:8000/ with:

pydoc -p 8000

Launch the webserver and a Tkinter-based GUI that provides search options etc.:

pydoc -g

Write the documentation for quickly.widgets to a HTML file quickly.widgets.html in the current directory:

pydoc -w quickly.widgets