{"categories":[{"label":"Libraries","url":"https://skillfed.io/packages/category/software-development-libraries/4"},{"label":"Home Automation","url":"https://skillfed.io/packages/category/home-automation"}],"enrichment":{"capability":"Defines finite state machines and statecharts with a declarative Python API, supporting flat states, compound hierarchies, parallel regions, history states, guards, and both sync and async callbacks.","skillfed_tags":["state-machine","workflow-engine","async-ready"],"use_cases":["Model approval workflows with conditional routing: pending \u2192 approved or rejected based on score guards.","Implement document editing pipelines with nested states: editing (draft/review) \u2192 published, tracking hierarchical progress.","Build deployment orchestration with parallel regions: compile and test simultaneously, fire done event only when all regions finish.","Create traffic light or traffic-control systems with cyclic state transitions and entry/exit side effects.","Handle async task workflows where callbacks are coroutines and state transitions await completion.","Implement error recovery: catch runtime exceptions as error.execution events and transition to failure states."],"what_it_does":"Python StateMachine is a declarative state machine and statechart library that lets you model complex workflows and control logic as classes with states and transitions. You define states as class attributes, connect them with transition rules, and attach callbacks (guards, entry/exit handlers) that run when events fire or states change. The library handles both synchronous and asynchronous callbacks transparently, automatically detecting async functions and switching to an async engine when needed.\n\nThe package supports flat finite state machines for simple workflows, but also hierarchical compound states for breaking complex behavior into nested levels, parallel regions for concurrent sub-machines, history states for remembering previous positions, and conditional transitions guarded by custom predicates. It includes error handling (runtime exceptions become error.execution events), eventless transitions that fire automatically when conditions are met, and introspection methods like checking active states or generating text/graphical representations of the machine. With no external runtime dependencies and support for Python 3.10+, it integrates cleanly into sync and async codebases.","worth_installing":"Yes. The library is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, zero runtime dependencies, and a clean declarative API. Install it if you need to model workflows, control logic, or any system with discrete states and event-driven transitions \u2014 from simple state machines to complex statecharts with hierarchy and concurrency. The async support and low friction make it suitable for modern Python projects."},"id":"python-statemachine","links":{"html":"https://skillfed.io/packages/python-statemachine","md":"https://skillfed.io/packages/python-statemachine.md","pypi":"https://pypi.org/project/python-statemachine/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-08-01","license_spdx":null,"license_treatment":"permissive","name":"python-statemachine","python_support":"supports_current","summary":"Python Finite State Machines made easy."},"popularity":{"monthly_downloads":1316242,"position":4068,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"3.2.1"}
