代碼簡單生成uml圖的小工具 Lumpy

在找代碼生成uml圖工具的時候,發現了這個小工具
安裝它也很簡單,前提是已經安裝好了python,並且已經有了pip

安裝

我是在windows下安裝的:
首先安裝 Tkinter
然後安裝Swampy 它包含了Lumpy,並且它裏面有一些有意思的程序
pip install swampy

具體安裝可以參照官方主頁:
http://www.greenteapress.com/thinkpython/swampy/install.html

測試

安裝完了就可以用它生成簡單的類圖了:
下面是我再看robotframework代碼時,參數解析類之間關係的代碼,新建一個對象,Lumpy就會把它的對象關係和類關係圖繪製出來,雖然不是很好看,但至少能夠看到類,對象之間大概的輪廓。

__author__ = 'Thomas'

from swampy import Lumpy

USAGE = '''
 -N --name name           Set the name of the top level test suite. Underscores
                          in the name are converted to spaces. Default name is
                          created from the name of the executed data source.
 -D --doc documentation   Set the documentation of the top level te
 '''
lumpy = Lumpy.Lumpy()
lumpy.make_reference()

from robot.utils import Application

application = Application(USAGE, '/HELLO/WORLD',
                             env_options='ROBOT_OPTIONS')

lumpy.object_diagram()
lumpy.class_diagram()

結果

運行完的對象圖:
object diagram

運行完的類圖:
class diagram

發佈了68 篇原創文章 · 獲贊 15 · 訪問量 24萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章