edgegraph.output.plantuml#
Create PlantUML sourcecode for a graph, and generate images from it.
This module mostly does not require PlantUML installed to operate. It only needs PlantUML installed to actually generate the images – for only sourcecode generation, it does not need to be installed.
See also
PlantUML’s homepage: https://plantuml.com/
The intended usage pattern is something like:
from edgegraph.builder import randgraph
from edgegraph.output import plantuml
graph = randgraph.randgraph()
# don't need PlantUML installed for this!
#
# puml_src is just a big long string. you can print it out, write it to a
# file, do whatever you want with it if you don't want to render it
# immediately
puml_src = plantuml.render_to_plantuml_src(graph,
plantuml.PLANTUML_RENDER_OPTIONS)
if plantuml.is_plantuml_installed():
# after this, my_graph.png will exist in current working directory
plantuml.render_to_image(puml_src, "my_graph.png")
else:
print("Sorry, couldn't render! Please ensure PlantUML is installed.")
Of course, much customization is available, primarily via the second argument
to render_to_plantuml_src(). PLANTUML_RENDER_OPTIONS should
have some pretty sensible defaults, and would be a good place to start reading
about customization.
If your installation of PlantUML needs non-standard invocations, that is handled in three possible ways:
If you need to customize the arguments to PlantUML, use the
PLANTUML_INVOKE_ARGSlist. This affects all invocations to PlantUML that this module will make.If you need to customize environs available to PlantUML, use the
PLANTUML_INVOKE_ENVdict. This affects all invocations to PlantUML that this module will make.If you need to change the location / execution of PlantUML, see the
plantumlargument tois_plantuml_installed()andrender_to_image().
Module Attributes
Default options for PlantUML rendering. |
|
List of arguments to always invoke plantuml with. |
|
Environment variable overrides to invoke plantuml with. |
Functions
|
Checks if PlantUML is installed and usable on this system. |
|
Accept string PlantUML source, and create an image. |
|
Render a universe to PlantUML source. |