Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benoitc/flower
collection of modules to build distributed and reliable concurrent systems in Python.
https://github.com/benoitc/flower
Last synced: about 2 months ago
JSON representation
collection of modules to build distributed and reliable concurrent systems in Python.
- Host: GitHub
- URL: https://github.com/benoitc/flower
- Owner: benoitc
- License: other
- Created: 2012-09-02T21:10:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-09-14T08:00:58.000Z (about 11 years ago)
- Last Synced: 2024-10-14T16:58:03.123Z (about 2 months ago)
- Language: Python
- Size: 439 KB
- Stars: 207
- Watchers: 23
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - flower - collection of modules to build distributed and reliable concurrent systems in Python. (Python)
README
==========================================================================================
**DEPPRECATED** Flower is now superseded by `Offset `_ .
==========================================================================================
Flower
======.. image:: https://secure.travis-ci.org/benoitc/flower.png?branch=master
:target: http://travis-ci.org/benoitc/flowercollection of modules to build distributed and reliable concurrent
systems in Python.::
a = “”
def f():
print(a)def hello():
a = "hello, world"
tasklet(f)()Requirements
------------- Python from 2.6 to 3.x
- A platform supported by `libuv `Simple example
--------------A simple example showing how to create a simple echo server.
.. code-block:: python
# Echo server program
from flower import tasklet, run
from flower.net import Listen# handle the connection. It return data to the sender.
def handle_connection(conn):
while True:
data = conn.read()
if not data:
breakconn.write(data)
# Listen on tcp port 8000 on localhost
l = Listen(('127.0.0.1', 8000), "tcp")
try:
while True:
try:# wait for new connections (it doesn't block other tasks)
conn, err = l.accept()# Handle the connection in a new task.
# The loop then returns to accepting, so that
# multiple connections may be served concurrently.t = tasklet(handle_connection)(conn)
except KeyboardInterrupt:
break
finally:
l.close()run()
And the echo client::
from flower import tasklet, run, schedule
from flower.net import Dial# connect to the remote server
conn = Dial("tcp", ('127.0.0.1', 8000))# start to handle the connection
# we send a string to the server and fetch the
# response backfor i in range(3):
msg = "hello"
print("sent %s" % msg)
resp = conn.write(msg)
ret = conn.read()
print("echo: %s" % ret)conn.close()
run()Installation
------------Flower requires Python superior to 2.6 (yes Python 3 is supported)
To install flower using pip you must make sure you have a
recent version of distribute installed::$ curl -O http://python-distribute.org/distribute_setup.py
$ sudo python distribute_setup.py
$ easy_install pipFor now flower can only be installed from sources. To install or upgrade to the latest released version of flower::
$ git clone https://github.com/benoitc/flower.git
$ cd flower && pip install -r requirements.txtLicense
-------flower is available in the public domain (see UNLICENSE). flower is also
optionally available under the MIT License (see LICENSE), meant
especially for jurisdictions that do not recognize public domain
works.