Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pyUML

Create simple Graphviz dot UML graphs with a python script.

For example, as you can see step by step in the usage notebook,

from pyUML import Graph, UMLClass

graph = Graph('pyUML')

graph_dot = UMLClass(
    "pydot.Dot"
)
graph.add_class(graph_dot)

graph_class = UMLClass(
    "GraphClass",
    caption="Graph",
    methods=["add_aggregation()", "add_class()", "add_classes()", 
             "add_composition()", "add_edge()", "add_implementation()"]
)
graph.add_class(graph_class)
graph.add_implementation(graph_class, graph_dot)

node = UMLClass(
    "pydot.Node"
)
graph.add_classes(node)

uml_class = UMLClass(
    "UMLClass",
    attributes={
        "public": {
            "name": "string",
            "caption": "string"},
        "private": {
            "_attributes": "dict[dict]",
            "_methods": "dict[list]"
        }
    },
    methods={
        "public": ["add_attribute()", "add_attributes()", "add_method()",
             "add_methods()", "update_content()"],
        "private": ["_render_attributes()", "_render_methods()", "_get_source_sep()"]
    })
graph.add_class(uml_class)
graph.add_implementation(uml_class, node)

uml_class_with_id = UMLClass(
    "UMLClassWithPublicIntID")
graph.add_class(uml_class_with_id)
graph.add_implementation(uml_class_with_id, uml_class)

edge = UMLClass(
    "pydot.Edge")

association = UMLClass(
    "Association",
    methods=["set_multiplicity()"])

implementation = UMLClass(
    "Implementation")

aggregation = UMLClass(
    "Aggregation")

composition = UMLClass(
    "Composition")

graph.add_classes(edge, association, implementation, aggregation, composition)
graph.add_implementation(association, edge)
graph.add_implementation(implementation, association)
graph.add_implementation(aggregation, association)
graph.add_implementation(composition, aggregation)

graph.add_composition(node, graph_dot, multiplicity_parent=1, multiplicity_child="1..*")
graph.add_composition(edge, graph_dot, multiplicity_parent=1, multiplicity_child="0..*")
graph.add_composition(association, graph_class, multiplicity_parent=1, multiplicity_child="0..*")

will be compiled into

digraph pyUML {
"pydot.Dot" [label="{pydot.Dot||}", shape=record];
GraphClass [label="{Graph||+ add_aggregation()\l+ add_class()\l+ add_classes()\l+ add_composition()\l+ add_edge()\l+ add_implementation()\l}", shape=record];
"pydot.Dot" -> GraphClass  [arrowtail=onormal, dir=back];
"pydot.Node" [label="{pydot.Node||}", shape=record];
UMLClass [label="{UMLClass|+ name : string\l+ caption : string\l- _attributes : dict[dict]\l- _methods : dict[list]\l|+ add_attribute()\l+ add_attributes()\l+ add_method()\l+ add_methods()\l+ update_content()\l- _render_attributes()\l- _render_methods()\l- _get_source_sep()\l}", shape=record];
"pydot.Node" -> UMLClass  [arrowtail=onormal, dir=back];
UMLClassWithPublicIntID [label="{UMLClassWithPublicIntID||}", shape=record];
UMLClass -> UMLClassWithPublicIntID  [arrowtail=onormal, dir=back];
"pydot.Edge" [label="{pydot.Edge||}", shape=record];
Association [label="{Association||+ set_multiplicity()\l}", shape=record];
Implementation [label="{Implementation||}", shape=record];
Aggregation [label="{Aggregation||}", shape=record];
Composition [label="{Composition||}", shape=record];
"pydot.Edge" -> Association  [arrowtail=onormal, dir=back];
Association -> Implementation  [arrowtail=onormal, dir=back];
Association -> Aggregation  [arrowtail=onormal, dir=back];
Aggregation -> Composition  [arrowtail=onormal, dir=back];
"pydot.Dot" -> "pydot.Node"  [arrowtail=diamond, dir=back, headlabel="\n1..*", taillabel="\n1"];
"pydot.Dot" -> "pydot.Edge"  [arrowtail=diamond, dir=back, headlabel="\n0..*", taillabel="\n1"];
GraphClass -> Association  [arrowtail=diamond, dir=back, headlabel="\n0..*", taillabel="\n1"];
}

and give

result

Dependencies

  • pydot
  • GraphViz, to render the graph (must be installed separately).

Metadata

Release files for pyUML 0.1.0a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyUML 0.1.0a0
File Size Uploaded Provenance Actions
pyUML-0.1.0a0.tar.gz 16.2 kB Without provenance Details for pyUML-0.1.0a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyUML 0.1.0a0
File Interpreter ABI Platform Actions
pyUML-0.1.0a0-py3-none-any.whl Python 3 none any Details for pyUML-0.1.0a0-py3-none-any.whl

Total release size: 33.2 kB

Release files / pyUML-0.1.0a0.tar.gz

Download URL pyUML-0.1.0a0.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f7cf29051e66b4f405e348ddb3942be410bcf4092d4e302042602857f29c29b7
BLAKE2b-256 checksum
How to use checksums
421fca7e39d0bd8f6ca02c8d7f27196ff9f1b83a68e304cf4971dd60d41a65b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / pyUML-0.1.0a0-py3-none-any.whl

Download URL pyUML-0.1.0a0-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cd802b35fef9abff4ee29404e9168b46a02c688d7e63ca4a8b690ea13180fbf
BLAKE2b-256 checksum
How to use checksums
7009a86dda763bbd9e9e666f3e03d143accce9d68d01f8112355f09bb8534c07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Security for pyUML 0.1.0a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page