Generating Python docstrings from Doxygen with swig

I found that there is a way to autogenerate Python docstrings from Doxygen documentation when creating bindings with swig:

  1. Instruct doxygen to output XML (this is different than GENERATE_TAGFILE):

    # If the GENERATE_XML tag is set to YES Doxygen will
    # generate an XML file that captures the structure of
    # the code including all documentation.
    GENERATE_XML           = YES
  2. Use either a python script or an XSLT transformation to extract information from the Doxygen XML into a swig .i file with %feature("docstring") commands.

  3. Include the resulting .i file in your master .i file:

    %include "../doc/dballe-doc.i"

This is all. Now you can fire up ipython, import your new library and get online help.