Subscribe to RSS Feed

Doxygen comments in Python

Feb 27th, 2008 by Joshua Scotton

I’ve been creating automatic documentation for the Entertainer project using Doxygen.
As you may know, Entertainer is written in python, so what follows is a short guide to commenting python code in a format that Doxygen will pick up.

Say you wrote the following:

class Demo:
  def theDemoTest(self, testParameter):
    #do something here
    return 0

You can comment this in Doxygen format in the following way:

class Demo:
"""
This is a description of the Demo class
@author Joshua Scotton
@version 0.1
"""
  def theDemoTest(self, testParameter):
  """
  This is the very, very, very, very, very, very, very, very, very, very long description of theDemoTest!
  @brief This is where you can put a brief description
  @see Demo
  @param testParameter String: Input Parameter is a string
  @return int Returns a 0 if successful
  """
    #do something here
    return 0

Quick Tag List
@author
@brief
@bug
@code and @endcode
@date
@file
@package
@param
@return
@see
@todo
@version
@warning

Post to Twitter Post to Delicious Post to Digg Post to Facebook

Tags: , , ,

5 Responses to “Doxygen comments in Python”

  1. Greg
    March 19, 2008 at 12:13 am

    What filter do you use in DoxyGen to make tags work?

  2. Joshua Scotton
    March 19, 2008 at 12:02 pm

    Hi Greg,

    The setup I use for Doxygen is described in my earlier post at http://www.joshuascotton.com/main/archives/64

    The filter I use is doxypy from http://code.foosel.org/doxypy and I edit the config.dox file to have the following line:

    INPUT_FILTER = “python /path/to/doxypy.py”

    Josh

  3. Recent Faves Tagged With "doxygen" : MyNetFaves
    March 27, 2009 at 12:05 pm

    [...] ago Bugzilla,Doxygen,SVN y otras cosas pichulas First saved by LOCKMANakaAC | 5 days ago Doxygen comments in Python First saved by marleneref | 10 days ago I’m Ready for School to Start First saved by [...]

  4. Adam
    January 8, 2010 at 9:59 pm

    Hey there. Thanks for writing up the instructions.

    I followed your directions, but doxygen is failing for me. If I leave out the doxypy filter (e.g. put nothing in the INPUT_FILTER field) then I can generate documentation fine, just obviously without being able to recognize the tags. If I enable the filter, however, then the generated HTML only displays the Main Page tab (i.e. no Modules). If it matters, I’m using OSX. Any ideas?

  5. Joshua Scotton
    January 8, 2010 at 10:32 pm

    The version I used in the guide was v3 and I haven’t used doxygen for a while. The latest version is v4.2 so it might have changed slightly in the last year. However, here goes…

    Have you got the FILTER_SOURCE_FILES set to YES? Also double check that the path to doxypy.py is correct (it’s probably different to my example on OSX).
    i.e.
    FILTER_SOURCE_FILES = YES
    INPUT_FILTER = “python /usr/local/bin/doxypy.py”

    Also from http://code.foosel.org/doxypy:
    If you want to make Doxygen recognize your module docstrings, you have to add a namespace command to the docstring

Leave a Reply

Calendar

March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Tweets

  • Microwaved Tea is really strong :) I probably should have waited until afterwards to put the milk in though...
  • It's 'Email Monday'...
Twitter

Me@Twitter