This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A minimal Python finite-state machine.

Automaton requires Python version 3.4 or greater.

Automaton is an easy to use, easy to maintain finite-state machine package for Python 3.4 or greater. The goal here is to have something minimal to enforce correctness and to avoid clutter from useless features.

In order to define an automaton, just subclass a provided base:

>>> from automaton import *
>>>
>>> class TrafficLight(Automaton):
>>>
>>>     go = Event("red", "green")
>>>     slowdown = Event("green", "yellow")
>>>     stop = Event("yellow", "red")

You’re done: you now have a new automaton definition that can be instantiated and used as a state machine:

>>> crossroads = TrafficLight(initial_state="red")
>>> crossroads.state
"red"

The automaton can be operated via events: signalling the occurrence of an event to the state machine triggers the evolution of the automaton from an initial state to a final state. You can trigger an event calling the class attributes themeselves:

>>> crossroads.go()
>>> crossroads.state
"green"
>>> crossroads.slowdown()
>>> crossroads.state
"yellow"

An alternative way, more convenient if triggering events progammatically, is to call the event() method:

>>> crossroads.event("stop")
>>> crossroads.state
"red"

Automaton enforces correctness in two ways:

  1. checking that the requested event is valid, that is a transition from the current state to the destination state exists in the state machine definition;
  2. checking whether the state graph representing the automaton is connected or not (that is it must have only one connected component).

Documentation

You can find the full documentation at http://automaton.readthedocs.org.

Contributors

Thanks to @simone-campagna for the countless hints.

Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python_automaton-0.2.0-py3.4.egg (11.7 kB) Copy SHA256 Checksum SHA256 3.4 Egg Oct 12, 2015
python-automaton-0.2.0.tar.gz (10.8 kB) Copy SHA256 Checksum SHA256 Source Oct 12, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting