plantuml-sequence¶
Create PlantUML sequence diagrams programmatically from Python.
The basic example of the PlantUML Documentation can be implemented with the following Python script:
from plantuml_sequence import Diagram
with open("my-diagram.puml", "w") as file, Diagram(file) as sequence:
(
sequence.message("Alice", "Bob", "Authentication Request")
.message("Bob", "Alice", "Authentication Response", arrow_style="-->")
.blank_line()
.message("Alice", "Bob", "Another authentication Request")
.message("Alice", "Bob", "Another authentication Response", arrow_style="<--")
)
Its output inside my-diagram.puml is:
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: Another authentication Response
@enduml
Tip
This file be compiled to an image using the plantuml command-line or a online server. See the
PlantUML documentation for more details.
For more examples covering different functionality see examples.
Contents¶
- Examples
- API documentation
DiagramDiagram.activate_lifeline()Diagram.active_lifeline()Diagram.arrow_style()Diagram.autonumber()Diagram.autonumber_resume()Diagram.autonumber_stop()Diagram.blank_line()Diagram.deactivate_lifeline()Diagram.delay()Diagram.destroy_lifeline()Diagram.divider()Diagram.enduml()Diagram.message()Diagram.newpage()Diagram.note_across()Diagram.participant_note()Diagram.participants_box()Diagram.space()Diagram.startuml()