seqdiag

raw JSON →
3.0.0 verified Fri May 01 auth: no python

seqdiag generates sequence-diagram images from text, part of the blockdiag family. Current version 3.0.0, requires Python >=3.7. Release cadence is sporadic.

pip install seqdiag
error ImportError: cannot import name 'parse' from 'seqdiag'
cause seqdiag 3.0.0 removed the top-level parse() function.
fix
Use 'from seqdiag import parser' and 'parser.parse_string(your_text)'.
error seqdiag: command not found
cause seqdiag's console script may not be installed if dependencies are missing.
fix
Run 'pip install seqdiag[all]' to install all dependencies including Pillow.
breaking In seqdiag 3.0.0, the API changed: parser.parse_string() is the canonical way; the old top-level functions are gone.
fix Use seqdiag.parser.parse_string() instead of the deprecated top-level seqdiag.parse().
gotcha The seqdiag command-line tool requires the font configuration to be set correctly. Without it, generated images may lack text.
fix Install fonts or set environment variable BLOCKDIAG_FONT_PATH.

Generate a sequence diagram from a text description and save as PNG.

from seqdiag import parser, builder, drawer
import codecs

# Read a .seqdiag file (or use a string)
diagram_text = """
seqdiag {
  A -> B [label = "request"];
  B -> A [label = "response"];
}
"""

tree = parser.parse_string(diagram_text)
diagram = builder.ScreenNodeBuilder.build(tree)

drawer.draw(diagram, 'output.png', 'PNG')