skillfed

fysom

pYthOn Finite State Machine

fysom v2.1.6 129.1K downloads/30d#11,683 on PyPI399
Permissive license MIT Abandoned released

What it is and what it does

Fysom is a lightweight finite state machine library that lets you define states, events, and transitions declaratively in a configuration dictionary. You create a Fysom object with an initial state and a list of events (each specifying source and destination states), and the library automatically generates methods for each event that trigger state transitions. You can query the current state, check if a transition is allowed, and optionally define callbacks to run on state changes.

The library is a Python port of Jake Gordon's JavaScript state machine, ported by Mansour Behabadi and maintained with unit tests and a build process. It has no external runtime dependencies and is designed for simple, deterministic state workflows—traffic light sequences, workflow pipelines, or any system with discrete states and well-defined transitions between them.

Use it for:

  • Model a workflow with discrete states (draft, review, approved, published) and define which transitions are allowed between them.
  • Implement a traffic light or similar simple state machine where events trigger deterministic state changes.
  • Build a game or interactive system with defined states (menu, playing, paused, game over) and event-driven transitions.
  • Validate state transitions in a business process to ensure only legal state changes occur.
  • Create a simple task scheduler or job runner that tracks job states (pending, running, completed, failed) and transitions.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Fysom is a finite state machine library that lets you define states, events, and transitions declaratively, then trigger state changes by calling event methods or the trigger() function.

No. The package is abandoned (last release September 2021, no commits since October 2021) and has high install friction due to source-only distribution. While it is MIT-licensed and has no known vulnerabilities, the lack of maintenance means no bug fixes or Python version updates. Use only if you have an existing codebase already depending on it; for new projects, choose an actively maintained state machine library.

Install

fysom on PyPI

pip

pip install fysom

uv

uv add fysom

poetry

poetry add fysom

Installing fysom

Before you install

High install friction: the package is abandoned (last release 2021-09-10, no commits since 2021-10-26) and has no runtime dependencies, but the distribution is source-only (tar.gz), requiring a build step on install.

License in practice

MIT licensed (permissive). You can use, modify, and distribute fysom freely in commercial and private projects, provided you include the license notice.

Quickstart

from fysom import Fysom

fsm = Fysom({'initial': 'green',
             'events': [
                 {'name': 'warn', 'src': 'green', 'dst': 'yellow'},
                 {'name': 'panic', 'src': 'yellow', 'dst': 'red'}]})

print(fsm.current)  # 'green'
fsm.warn()
print(fsm.current)  # 'yellow'

Verify before relying

  • Whether the package works reliably on Python versions beyond 3.5 (documentation mentions testing on 2.6–3.5 and PyPy, but no recent verification).
  • Whether there are known issues or edge cases in production use given the abandoned status since late 2021.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 1,799 days since the last release
Last repo commit
First released
Downloads 129,116/month — #11,683 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: fysom-2.1.6.tar.gz

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonTopic :: Scientific/Engineering

Tags

finite state machinestate machine libraryfsm pythonstate transitionsevent-driven stateworkflow state managementstate machine framework
state-machineworkflowabandoned

More Scientific/Engineering packages