Doxygen

Doxygen is a tool that creates documentation of file by extracting comments from it. Doxygen can be used with any language like C, C++, Python, PHP etc. But each language and framework has different different comment style , comment style are also given in official site of doxygen http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html ,so use them carefully.   Wrong comment style can effect your docnumentation. According to each language and framework, you have to change your .conf file, which you have created in project folder.

$ sudo apt-get install doxygen
$ cd PYTHON //your project folder
manpreet@hp:~/PYTHON$ doxygen -g my_doc.conf //create configuration file in projectfolder

Change my_doc.conf file according to language used. For PYTHON  edit  .conf file using below:

INPUT_FILTER = "python /path/to/doxypy.py" //(python/manpreet/PYTHON/doxypy.py) 
FILTER_SOURCE_FILES = YES 
HIDE_UNDOC_RELATIONS = NO OPTIMIZE_OUTPUT_JAVA = YES 
JAVADOC_AUTOBRIEF = YES MULTILINE_CPP_IS_BRIEF = YES
DETAILS_AT_TOP = YES EXTRACT_ALL = YES
EXTRACT_STATIC = YES SHOW_DIRECTORIES = YES 
SOURCE_BROWSER = YES ALPHABETICAL_INDEX = YES 
COLS_IN_ALPHA_INDEX = 8
TOC_EXPAND = YES
DISABLE_INDEX = YES 
GENERATE_TREEVIEW = YES

After this create python file and add comments (for example:python_class.py)

python_class.py
"""@package docstring
   Documentation for this module
   more detail """

class student:
        """documentation for class
        variable initialisation"""
    count=0
 
    def profile(self, name, rollno):
               """documentation for function
                accessing input variables through self.""" 
        self.name=name
        self.rollno=rollno
        student.count+=1
               """display student number."""    
        print ' student no:', student.count     
        print '\n'         
 
    def display_profile(self):
                """function for showing output"""
        print ' name: ', self.name 
        print ' rollno:', self.rollno
        
 """class object created"""
s1=student()
s2=student()
"""accessing functions using objects."""
s1.profile('man',123)
s1.display_profile()
s2.profile('an',121)
s2.display_profile() 
print '\n'
"""show total students.""" 
print 'Total student:', student.count

After adding comments , Run commands on terminal

manpreet@hp:~/PYTHON$ doxygen  python_class.py //it will create two folders /html and /latex in project folder PYTHON
manpreet@hp:~/PYTHON$ firefox html/index.html

Now documentation is ready for python file python_class.py

doxygen_my

Advertisements

One thought on “Doxygen

  1. Pingback: September 27, 2015 | New Experience

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s