What's the best way to generate a UML diagram from Python source code? [closed] What's the best way to generate a UML diagram from Python source code? [closed] python python

What's the best way to generate a UML diagram from Python source code? [closed]


You may have heard of Pylint that helps statically checking Python code. Few people know that it comes with a tool named Pyreverse that draws UML diagrams from the python code it reads. Pyreverse uses graphviz as a backend.

It is used like this:

pyreverse -o png -p yourpackage .

where the . can also be a single file.


Epydoc is a tool to generate API documentation from Python source code. It also generates UML class diagrams, using Graphviz in fancy ways. Here is an example of diagram generated from the source code of Epydoc itself.

Because Epydoc performs both object introspection and source parsing it can gather more informations respect to static code analysers such as Doxygen: it can inspect a fair amount of dynamically generated classes and functions, but can also use comments or unassigned strings as a documentation source, e.g. for variables and class public attributes.