pyfcstm.entry.plantuml

State Machine DSL to PlantUML CLI Integration.

This module integrates a PlantUML generator into a Click-based command-line interface. It provides a subcommand that reads state machine DSL code from a file, parses it into an internal model, and emits PlantUML text either to a file or to standard output.

The module is intended to be used as part of a larger CLI application that manages multiple subcommands. It does not expose any public API directly; instead, it contributes functionality through the helper function that registers the subcommand.

Note

The CLI entry point relies on pyfcstm.dsl.parse.parse_with_grammar_entry() and pyfcstm.model.model.parse_dsl_node_to_state_machine() to build the model and assumes the input file contains valid state machine DSL content.

Example:

>>> import click
>>> from pyfcstm.entry.plantuml import _add_plantuml_subcommand
>>> cli = click.Group()
>>> _add_plantuml_subcommand(cli)  
<...Group...>

PLANTUML_OPTION_TYPES

pyfcstm.entry.plantuml.PLANTUML_OPTION_TYPES: Dict[str, type | str] = {'abstract_action_marker': <class 'str'>, 'collapse_empty_states': <class 'bool'>, 'collapsed_state_marker': <class 'str'>, 'detail_level': <class 'str'>, 'event_legend_position': <class 'str'>, 'event_name_format': 'tuple[str, ...]', 'event_visualization_mode': <class 'str'>, 'max_action_lines': <class 'int'>, 'max_depth': <class 'int'>, 'show_abstract_actions': <class 'bool'>, 'show_aspect_actions': <class 'bool'>, 'show_concrete_actions': <class 'bool'>, 'show_during_actions': <class 'bool'>, 'show_enter_actions': <class 'bool'>, 'show_events': <class 'bool'>, 'show_exit_actions': <class 'bool'>, 'show_lifecycle_actions': <class 'bool'>, 'show_pseudo_state_style': <class 'bool'>, 'show_transition_effects': <class 'bool'>, 'show_transition_guards': <class 'bool'>, 'show_variable_definitions': <class 'bool'>, 'state_name_format': 'tuple[str, ...]', 'transition_effect_mode': <class 'str'>, 'use_skinparam': <class 'bool'>, 'use_stereotypes': <class 'bool'>, 'variable_display_mode': <class 'str'>, 'variable_legend_position': <class 'str'>}

Accepted value types for PlantUML CLI configuration keys.

build_plantuml_output

pyfcstm.entry.plantuml.build_plantuml_output(input_code_file: str, detail_level: str = 'normal', config_options: Tuple[str, ...] = ()) str[source]

Build PlantUML text from a state machine DSL file.

This helper centralizes the common CLI workflow for reading DSL code, parsing the state machine model, applying PlantUML options, and rendering the final PlantUML text representation.

Parameters:
  • input_code_file (str) – Path to the input DSL file.

  • detail_level (str, optional) – PlantUML detail level preset, defaults to 'normal'.

  • config_options (Tuple[str, ...], optional) – Additional PlantUML configuration options in key=value format.

Returns:

Rendered PlantUML text.

Return type:

str

Raises:

Example:

>>> plantuml_text = build_plantuml_output('traffic_light.fcstm', detail_level='minimal')
>>> plantuml_text.startswith('@startuml')
True