Registry / workflow / fysom
library2.1.6pypypi✓ verified 86d ago

A simple Python finite state machine (FSM) for state management in applications. Current version: 2.1.6. Release cadence is irregular, with maintenance updates as needed.

pip install fysom
INSTALL
IMPORT
SIG · FYSOM
F
fysom
workflowpythonv2.1.6
Install
2.4s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Fysom
from fysom import Fysom
old.fysom.Fysom
In previous versions, the import path included 'old' package. Use 'from fysom import Fysom' in 2.x.

Create a simple state machine with two states and two events.

from fysom import Fysom fsm = Fysom({ 'initial': 'asleep', 'events': [ {'name': 'wakeup', 'src': 'asleep', 'dst': 'awake'}, {'name': 'sleep', 'src': 'awake', 'dst': 'asleep'}, ] }) print(fsm.current) # 'asleep' fsm.wakeup() print(fsm.current) # 'awake' fsm.sleep() print(fsm.current) # 'asleep'
Debug
Known issues
breakingIn version 2.0.0, the API changed significantly. The old 'FysomGlobal' and event callback signatures are deprecated. Upgrade scripts may break.
fix
Use the new Fysom class with dictionary-based event definitions. Callbacks now receive the event object instead of state names as separate arguments.
affects: >=2.0.0
deprecatedThe 'final' state support in event definitions (from v1.0.13) is deprecated; use the separate 'final' property in Fysom constructor instead.
fix
In v2.x, set 'final' as a top-level key in the constructor dict: Fysom({'initial': 's1', 'final': 's5', 'events': [...]})
affects: <2.0.0
gotchaEvent names must not conflict with method names on the Fysom object (e.g., 'current', 'is_finished'). Doing so will silently override or cause AttributeError.
fix
Avoid naming events 'current', 'is_finished', or any reserved attribute.
affects: all
Errors
Common errors & fixes
ImportError: No module named fysom
The package is not installed or pip install failed due to old setuptools.
fix
Upgrade pip and setuptools: pip install --upgrade pip setuptools && pip install fysom
TypeError: __init__() got an unexpected keyword argument 'src'
Using version 1.x style event definitions with separate arguments instead of a dictionary.
fix
In v2.x, events must be defined as a list of dictionaries, each with keys 'name', 'src', 'dst'. Example: events=[{'name': 'wake', 'src': 'asleep', 'dst': 'awake'}]
AttributeError: 'Fysom' object has no attribute 'wakeup'
The event name is misspelled or the event was defined with a different name.
fix
Check the event definition; the method name is exactly the 'name' field of the event dictionary. Ensure it is lowercase and matches.
Upgrade
Version history
2.1.6latest on PyPI · released Sep 10, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
fysom — pip install fysom · libregistry