jonasehrlich / plantuml-sequence

Create PlantUML sequence charts from Python

Home Page:https://plantuml-sequence.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

This file be compiled to an image using the plantuml command-line or a online server. See the PlantUML documentation for more details.


Read the documentation on ReadTheDocs!


Installation and supported Python versions

pip install plantuml-sequence

Python 3.10+ is supported

Supported PlantUML features

Not all of the features of message sequence charts are supported yet. See the list of implemented features below.

General

  • Use teoz renderer

Participants

  • Declaring participants
  • Multiline participants
  • Create participant with message
  • Lifeline activation / deactivation
  • Lifeline auto-activate
  • Participants encompass (Box around participants)
  • Remove foot boxes

Messages

  • Messages
  • Basic autonumber message numbering
  • Advanced auto numbering
    • autonumber formats
    • autonumber sequence increments
  • Hide unlinked participants
  • Mainframe

Notes

  • Different note shapes (note, hnote, rnote)
  • Notes on messages
  • Notes over / left / right of lifelines
  • Notes across all participants
  • Multiple notes at the same level

Flow

  • Basic message grouping
  • alt / else groups
  • Divider
  • Reference
  • Delay
  • Space

Styling

  • Colored groups
  • Arrow style change
    • Standard arrow styles
    • Short arrows
  • Slanted arrows
  • Styling changes using the skinparam command

Preprocessing

Currently no preprocessing features are planned to be supported

  • Variable definition
  • Boolean expression
  • Conditions
  • While loops
  • Procedures & functions blocks
  • Include directive
  • Memory dump
  • Assertions

About

Create PlantUML sequence charts from Python

https://plantuml-sequence.readthedocs.io/

License:MIT License


Languages

Language:Python 100.0%