Python State Machine

Github | PyPI

The State Pattern solves many problems, untangles the code and saves one’s sanity. Yet.., it’s a bit rigid and doesn’t scale. The goal of this library is to give you a close to the State Pattern simplicity with much more flexibility. And, if needed, the full state machine functionality, including FSM, HSM, PDA and other tasty things.

Goals:
  • Provide a State Pattern-like behavior with more flexibility
  • Be explicit and don’t add any code to objects
  • Handle directly any kind of event (not only strings) - parsing strings is cool again!
  • Keep it simple, even for someone who’s not very familiar with the FSM terminology