Skip to content

twixl0ver/UMLGenerator

Repository files navigation

UMLGenerator

App that generates UML diagram based on your code

Setup

For the UMLGenerator to work, you should download Graphviz

Note: Remember add Graphviz to the system path

alt_text

Modification syntax

  • Ignore

Write #@UML ignore before defintition of the class, so that it is ignored:

# class A won't be drawn
#@UML ignore
class A: 

To ignore field / method, write #@UML ignore on the same line:

# variable example won't be drawn
self.example = 10 #@UML ignore
# function func won't be drawn
def func(self): #@UML ignore
  • Compositions / Aggregations

To indicate a composition, point the type of variable using typing

class A:
    pass
    
class B:
    def __init__(self):
        # a is composition of class A
        self.a: A = A()

uml

If this an aggregation, just write #@UML aggr after variable: (any prefix of "aggregation" can be used instead of "aggr")

self.a: A = A() #@UML aggr

uml

  • Class groups

In order for the class in the diagram to be in some group / groups, write before definition #@UML clusters and then names of all groups, separated by commas. It is better to write names from a larger group to a smaller one, but not necessarily

#@UML clusters Group1
class A:
    pass
    
#@UML clusters Group1, Group2
class B:
    pass
    
#@UML clusters Group1, Group2, Group3
class CorrectOrder:
    pass
    
#@UML clusters Group2, Group1, Group4, Group3
class IncorrectOrder:
    pass

uml

Note: If you want to use several modifications at once, separate them with ';' :

#@UML clusters Group1, Group2; ignore
class B:
    def __init__(self):
        self.a: int = 10 #@UML ignore; aggr

Settings

If you want to enable option, write true/1/yes, otherwise - false/0/no

  • IgnorePrivate

Ignores private fields

By default - true

  • IgnoreProtected

ignores protected fields

By default - true

  • IgnorePrivateComps

If IgnorePrivate enabled, ignores private fields that are composition/aggregation

By default - false

  • IgnoreProtectedComps

If IgnoreProtected enabled, ignores protected fields that are composition/aggregation

By default - false

  • ReadFilesOnlyInThisDir

If enabled, reads files only in this directory, otherwise goes recursively through all folders

By default - false

  • DrawUndefinedClasses

Enable drawing classes that are someone's composition/aggregation or parent class, but have no declaration in the code

By default - true

  • GroupByFiles

Enables grouping of classes into groups in the same way as they are defined in files

By default - true

  • DrawOneClassGroup

If GroupByFiles enabled, enable drawing group (not its classes) which contains one class

By default - false

  • RemoveAccessPrefix

Remove access prefixes from private and protected fields

By default - true

  • AlternativeEngine

Enable alternative graphviz engine. By default it is DOT engine, the alternative - FDP. Almost always FDP works much worse

By default - false

  • Color

Changes the color of diagram. There can be any HTML color here

By default - yellow

  • Files

There you can write a list of local file paths to be read

By default - Read all *.py files

  • IgnoreFiles

There you can write a list of local file paths to be ignored

By default - ignores nothing

About

App that generates UML diagram based on your code

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages