Versatile and flexible Python State Machine library.
.. image:: https://travis-ci.org/pgularski/pysm.svg?branch=master :target: https://travis-ci.org/pgularski/pysm
.. image:: https://coveralls.io/repos/github/pgularski/pysm/badge.svg?branch=master :target: https://coveralls.io/github/pgularski/pysm?branch=master
.. image:: https://api.codacy.com/project/badge/Grade/6f18f01639c242a0b83280a52245539d :target: https://www.codacy.com/app/pgularski/pysm?utm_source=github.com&utm_medium=referral&utm_content=pgularski/pysm&utm_campaign=Badge_Grade
.. image:: https://landscape.io/github/pgularski/pysm/master/landscape.svg?style=flat :target: https://landscape.io/github/pgularski/pysm/master :alt: Code Health
.. image:: https://readthedocs.org/projects/pysm/badge/?version=latest :target: http://pysm.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status
It can do simple things like this:
.. image:: https://cloud.githubusercontent.com/assets/3026621/15031178/bf5efb2a-124e-11e6-9748-0b5a5be60a30.png
Or somewhat more complex like that:
.. image:: https://cloud.githubusercontent.com/assets/3026621/15031148/ad955f06-124e-11e6-865e-c7e3340f14cb.png
The State Pattern <https://en.wikipedia.org/wiki/State_pattern>
_
solves many problems, untangles the code and saves one's sanity.
Yet.., it's a bit rigid and doesn't scale. The goal of this library is to give
you a close to the State Pattern simplicity with much more flexibility. And,
if needed, the full state machine functionality, including FSM <https://en.wikipedia.org/wiki/Finite-state_machine>
_, `HSM
<https://en.wikipedia.org/wiki/UML_state_machine
https://en.wikipedia.org/wiki/Pushdown_automaton`_ and other tasty things.
Documentation <http://pysm.readthedocs.io/en/latest/examples.html>
_ for
examples)JavaScript <https://github.com/pgularski/smjs>
_).Install pysm from PyPI <https://pypi.python.org/pypi/pysm/>
_::
pip install pysm
or clone the Github pysm repository <https://github.com/pgularski/pysm/>
_::
git clone https://github.com/pgularski/pysm
cd pysm
python setup.py install
Read the docs for API documentation and examples - http://pysm.readthedocs.io/
See Unit Tests to see it working and extensively tested.
The library works with pyboards!::
import upip upip.install('upysm')
Documentation <http://pysm.readthedocs.io>
_Installation <http://pysm.readthedocs.io/en/latest/installing.html>
_Github <https://github.com/pgularski/pysm>
_Issues <https://github.com/pgularski/pysm/issues>
_Examples <http://pysm.readthedocs.io/en/latest/examples.html>
_