How to Generate UML Diagrams from Python Source Code
The Unified Modeling Language is a general-purpose, developmental modeling language in software engineering that is intended to provide a standard way to visualize the design of a system.
Despite designing and thinking through the class structure before coding, developers might have to restructure and refactor the code during implementation. It is also good to generate UML diagrams from code and see if it matches the actual design.
Pyreverse
Pyreverse is a set of utilities to reverse engineering Python code. It uses a representation of a Python project in a class hierarchy which can be used to extract any information (such as generating UML diagrams or unit tests, as pyargo and py2tests).
The package is now a part of pylint
so to install it. You need pylint installed in your python environment.
Generating Diagrams
pip install pylintpyreverse -o png <path_to_src>
The generated image looks something like this.
Originally published at https://bhavaniravi.com.