To install using uv:
uv add python-statemachineTo install using poetry:
poetry add python-statemachineAlternatively, if you prefer using pip:
python3 -m pip install python-statemachineSome features require extra dependencies, available as pip extras:
python3 -m pip install "python-statemachine[diagrams]" # pydot, to generate diagrams from your machines
python3 -m pip install "python-statemachine[yaml]" # PyYAML, to load YAML statechart documents
python3 -m pip install "python-statemachine[validation]" # jsonschema, to validate documents (validate=True)
python3 -m pip install "python-statemachine[io]" # PyYAML + jsonschema, the full JSON/YAML IO stackDiagram generation also requires the Graphviz system package (see
). The [yaml], [validation] and [io] extras back the declarative loaders
documented in ; loading JSON needs no extra, as it uses only the standard library.
The sources for Python State Machine can be downloaded from the Github repo.
You can either clone the public repository:
git clone git://github.com/fgmacedo/python-statemachineOr download the tarball:
curl -OL https://github.com/fgmacedo/python-statemachine/tarball/mainOnce you have a copy of the source, you can install it with:
python3 -m pip install -e .