Skip to main content

Create PlantUML sequence charts programmatically from Python

Project description

plantuml-sequence

Create PlantUML sequence charts 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plantuml_sequence-0.3.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

plantuml_sequence-0.3.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file plantuml_sequence-0.3.0.tar.gz.

File metadata

  • Download URL: plantuml_sequence-0.3.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.4.0

File hashes

Hashes for plantuml_sequence-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fd4f5bb6f33e89828eafaff7792889ed7b64973c7d72d3ce02285e3a21acf624
MD5 fef0cf85398498a56047aff6d054c551
BLAKE2b-256 4d7d61fde9135e81499d0143bed171f317b31606d8942702f0dab98bce6e456c

See more details on using hashes here.

File details

Details for the file plantuml_sequence-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for plantuml_sequence-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 462f8665df902869681c69eedbcee4816034a48b4c23e8479765fc1e75f84aec
MD5 f800f93fa75bb6e0d3677b940bfb813c
BLAKE2b-256 4014fc95f743585db569e6a078f268eb1aa4ed9b51a10368c6a7501902935789

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page