transitions
A lightweight, object-oriented Python state machine implementation with many extensions.
What it is and what it does
Transitions is a state machine library that embeds finite-state behavior into Python objects. You define states and transitions between them, then attach the machine to a model object; the library automatically creates trigger methods that move the object between states. It supports callbacks (actions executed before, after, or during transitions), conditional transitions, and wildcard source states.
The library is designed for modeling workflows, event-driven systems, and stateful processes where you need to enforce valid state changes and execute side effects when transitions occur. It's built on top of six for Python 2/3 compatibility and has a minimal dependency footprint.
Use it for:
- Model application workflows where objects move through defined states (e.g., order processing: pending → shipped → delivered).
- Implement event-driven systems where triggers initiate state changes and callbacks execute business logic.
- Build game or simulation logic where entities have discrete states and rules governing transitions between them.
- Enforce state validity in domain objects by preventing invalid transitions and logging state changes.
- Create interactive state machines for chatbots, form wizards, or multi-step processes.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Transitions is a lightweight state machine library that lets you attach finite-state behavior to Python objects, with support for states, transitions, triggers, and callbacks.
Yes, if you need a straightforward state machine for modeling workflows or stateful behavior. The library is stable, permissively licensed, and has low install friction. However, note that maintenance is aging (last release July 2025, no recent commits); if you require active development or frequent updates, verify that the project's pace aligns with your needs. No known security vulnerabilities.
Install
transitions on PyPI
pip
pip install transitionsuv
uv add transitionspoetry
poetry add transitionsInstalling transitions
Before you install
Low install friction; pure Python wheel with only six as a runtime dependency. Maintenance status is aging—last release was 2025-07-02 and the repository shows no recent activity, though it remains unarchived with a substantial GitHub presence.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
from transitions import Machine
class Matter:
pass
lump = Matter()
machine = Machine(model=lump, states=['solid', 'liquid'], initial='solid')
machine.add_transition(trigger='melt', source='solid', dest='liquid')
lump.melt() # Triggers transition
print(lump.state) # 'liquid'
Verify before relying
- Whether the aging maintenance status (last release 2025-07-02, no recent commits) affects stability or security for new projects.
- Whether extensions mentioned in the description (e.g., Diagrams) are included or require separate installation.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — six |
| Maintenance | aging — 408 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,944,762/month — #2,814 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: transitions-0.9.3-py2.py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
fysomFysom is a finite state machine library that…
permissive · top 15,000 on PyPI
python-statemachineDefines finite state machines and statecharts…
permissive · top 5,000 on PyPI
AutomatAutomat provides a Python library for building…
permissive · top 5,000 on PyPI
automatonAutomaton provides state machine classes and…
permissive · top 15,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
django-pgtriggerdjango-pgtrigger lets you define PostgreSQL…
permissive · top 5,000 on PyPI
bddlBDDL is a domain-specific language for defining…
unclear · top 15,000 on PyPI
cellpylibCellPyLib simulates 1- and 2-dimensional…
permissive · top 15,000 on PyPI