Skip to content

akaihola/lusmu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

authors

Antti Kaihola

organization

Eniram Ltd

copyright

2013 Eniram Ltd. See the LICENSE file at the top-level directory of this distribution and at https://github.com/akaihola/lusmu/blob/master/LICENSE

Documentation | Source code | PyPI | Download | License

Lusmu – a dataflow/reactive programming library for Python

Lusmu is a Python library for reactive programming (a form of dataflow programming). Operations on data are done using a directed graph which consists of input nodes and calculation nodes.

Lusmu uses the invalidate/lazy-revalidate evaluation model: reading the value of a node triggers its calculation action and reads the values of its inputs. Thus, only required calculations are executed.

A minimal example

from lusmu.core import Input, Node, update_inputs

root = Input()
square = Node(action=lambda x: x ** 2,
              inputs=Node.inputs(root))

update_inputs([(root, 5)])
print square.value

The output:

25

See mouse.py and triangle.py for more comples examples.

About

Lazy evaluation graph library. See the branch https://github.com/akaihola/lusmu/tree/fix-terminology for a version matching the PyCon Finland 2014 talk and related blog posts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages