Skip to content

Render Event human readable name #600

Closed

Description

@denisSurkov

Event has human readable name, but graph labels do not use it. Is it possible to fix it?

from statemachine import StateMachine, State, Event
from statemachine.contrib.diagram import DotGraphMachine


class ExampleStateMachine(StateMachine):
    active = State(name='Active Human Text', initial=True)
    suspended = State(name='Suspended Human Text', final=True)

    suspend = Event(
        active.to(suspended),
        name="Human Suspend",
    )

graph_machine = DotGraphMachine(ExampleStateMachine)
g = graph_machine()
g.write_png('example.png')
Image

Thank you for this nice library!

Activity

  1. fgmacedo commented on Mar 21, 2026

    @fgmacedo
    Owner

    Thanks for reporting this and for the kind words about the library!

    This is now fixed in #601 — Event.name is auto-humanized from the id (e.g., suspend → Suspend, pick_up → Pick up), and explicit name= values are preserved as expected. Diagrams, Mermaid output, and text tables all use the human-readable name now.

    This should land in the next release.

  2. added this to the 3.1.0 milestone on Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions