Python is a language that supports object-oriented programming, and in large software projects we often use object-oriented features to organize our code, is there a tool that can help us extract UML diagrams from existing code? The answer is yes. Below, we describe each of these tools individually.
Pyreverseis a set of Python code reverse engineering (reverse engineering) tools. It uses a class-hierarchy Python project to indicate that any available information has been extracted and can be easily applied to the generation of UML diagrams, or unit tests such as Pyargo and py2tests. Pyreverse has been integrated into the pylint.
GraphvizIt's Bell Labs. Open source graphical Drawing toolkit Graphviz is an open source graphing software that draws structured abstractions and network graphics, and is used in many other technical fields, such as networking, bioinformatics, software engineering, database and Web design, machine learning, and visualization interfaces. The ability to extract UML diagrams from existing code can be implemented using Pyreverse and Graphviz in a comprehensive form.
How to install
Graphviz installation in the Linux environmentUsing Yum to install automatically, execute the following command under any path: Yum install ' graphviz* '--skip-broken when prompted, enter "Y". --skip-broken: Skip error dependency, do not add this parameter will prompt installation package dependency error, because there is no need for other installation packages, so skip.
Install under Windows: http://www.graphviz.org/Download_windows.php Note: More than 2.30 versions, you need to manually add them to the environment variable
pyreverse Tool InstallationPyreverse can easily generate UML class diagrams, Pylint with Pyreverse this tool. Installing Pylintpip install Pylint with PIP
start usingGenerally used as: Pyreverse-asmy-o PNG path-asmy: For pyreverse option parameter, all parameters can be viewed through Pyreverse--help. -asmy produces the most detailed results, even including the result parsing of class attributes. If you only need UML diagrams for classes and classes, it is not recommended to add-asmy. -o Specifies the output file format, support PNG, SVG, DOT, etc. path for the file or folder to be parsed the output results will be directly generated at the command line current path. Results without-asmy at the above
Python Code Extraction UML