fysom
pYthOn Finite State Machine
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 fysomuv
uv add fysompoetry
poetry add fysomInstalling 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
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
python-statemachineDefines finite state machines and statecharts…
permissive · top 5,000 on PyPI
transitionsTransitions is a lightweight state machine…
permissive · top 5,000 on PyPI
django-fsm-2Adds declarative finite state machine support…
permissive · top 15,000 on PyPI
django-fsmProvides finite state machine support for…
permissive · top 15,000 on PyPI
django-fsm-logAutomatically logs state transitions for Django…
permissive · top 15,000 on PyPI
automatonAutomaton provides state machine classes and…
permissive · top 15,000 on PyPI
greeneryParses and manipulates regular expressions by…
permissive · top 15,000 on PyPI
observableObservable provides a lightweight event system…
permissive · top 15,000 on PyPI
django-pgtriggerdjango-pgtrigger lets you define PostgreSQL…
permissive · top 5,000 on PyPI
AutomatAutomat provides a Python library for building…
permissive · top 5,000 on PyPI