Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chenjd/pyuml
A toy project that generates UML diagrams of Python code by parsing the abstract syntax tree of the target Python code.
https://github.com/chenjd/pyuml
ast code-analysis python python3 uml
Last synced: 2 months ago
JSON representation
A toy project that generates UML diagrams of Python code by parsing the abstract syntax tree of the target Python code.
- Host: GitHub
- URL: https://github.com/chenjd/pyuml
- Owner: chenjd
- License: mit
- Created: 2020-03-05T03:22:12.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T22:35:45.000Z (over 1 year ago)
- Last Synced: 2024-05-02T05:11:39.196Z (9 months ago)
- Topics: ast, code-analysis, python, python3, uml
- Language: Python
- Homepage:
- Size: 862 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyuml
A toy project that generates UML diagrams of Python code by parsing the abstract syntax tree of the target Python code.![](https://img.shields.io/github/v/release/chenjd/pyuml?sort=semver)
[![Build Status](http://52.230.5.15:8080/buildStatus/icon?job=pyuml)](http://52.230.5.15:8080/job/pyuml/)
![](https://img.shields.io/jenkins/coverage/cobertura?jobUrl=http%3A%2F%2F52.230.5.15%3A8080%2Fjob%2Fpyuml%2F)## How to use
========================================
2uml load config exit help version2uml:
usage: 2uml [-h] input output
Generate UML diagram from Python source codepositional arguments:
input input file/folder
output output folderoptional arguments:
-h, --help show this help message and exit
load:
usage: load [-h] input
Deserialize AST data from serialization datapositional arguments:
input input class nameoptional arguments:
-h, --help show this help message and exit
config:
Print config info
version:
Print version info
exit:
Exit the app
## A Command Line Interpreter runs on Windows & macOS
You can download it from the [release page](http://github.com/chenjd/pyuml/releases).## Support [Type Annotation](https://docs.python.org/3/library/typing.html) & [Type Comments](https://www.python.org/dev/peps/pep-0484/#type-comments)
# Type Annotation
class Car(MovementObject):
def __init__(self):
self.num_one: int = 1
self.num_two: float = 2.0
self.name: str = "car"def get_user_name(self, user_id: int) -> str:
return 'car'
https://github.com/chenjd/pyuml/blob/master/test/test_py_code/py_type_annotations.py# Type Comments
class Car(MovementObject):
def __init__(self):
self.num_one = 1 # type: int
self.num_two = 2.0 # type: float
self.name = "car" # type: strdef get_user_name(self,
user_id, # type: int
): # type: str
return 'car'
https://github.com/chenjd/pyuml/blob/master/test/test_py_code/py_type_comments.py
![](./result/uml0.png)## Testing
#### Unit Test
You can find unit test in the **test** folder. There are some code resources be used in the tests. There are 23 test cases now.![](./result/unittest_screenshot.png)
## Data Persistence
store some information of a class, such as the count of methods in a class etc. in artifact folder.## Config
[DEFAULT]
author = jiadong chen
version = 0.0.1
url = https://github.com/chenjd/pyuml
userConfig.ini## Exception Handle
exception information will be written to the error.log file in log folder.