6

I am struggling to understand how doxygen works with namespaces in Python. A namespace of the name "filename" i.e. temp.py, is generated by default. I can also declare new namespaces with the \package or \namespace command.

However, what I don't understand is why the class below (or any other definition) always appears under the temp namespace?

Please help me understand how the namespace command works in doxygen.

If you know how and why /namespace pr /package commands are used in doxygen, you can bypass the example below and directly answer it.

#filename = temp.py
##\mainpage Main Page Title
#\brief main page title comments  \n




## class class_demo1 \n
#  the class declared below \n
class class_demo1:
        pass

from new_package import *

Now, I am adding a new namespace by the name \new_package , added to the temp.py file

##\package new_package
#new namespace comments \n

I have also created a file named \new_package.py and added the below lines in it:

def demo_fun:
    pass

class demo_class:
    pass

In the generated documentation, I get \class_demo1 under namespace \temp. However, the new namespace \new_package.py doesn't display the class and def declared under it.

Ani
  • 918
  • 1
  • 10
  • 25

1 Answers1

3

To put Demo class into new_package namespace if it is defined in new_package.temp module:

new_package/
├── __init__.py
│   #   from .temp import Demo
└── temp.py
    #   class Demo:
    #       pass

In this case doxygen would need just to reflect the relation that is already in the code.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
  • @Sebastian can you post some small example code (new or based on my example) to help me better understand it. – Ani Feb 07 '12 at 04:12