I’m thinking of writing some simple static code analysis that uses class declarations and comments to generate UML diagrams.
Can you suggest a comfortable way to parse Python scripts in a structured way? I will need to detect class declaration, module imports, parameter assignment in __init__ and comments in a structured way.
Maybe you can point me to the specific sections I need? There is a large section on “Python Language Services” (parser, AST, …), but I cannot make sense of which one I need and I’d like to avoid digging through all of them.
You could use inspect to inspect the code after loading it:
http://docs.python.org/library/inspect.html