Eventlet is a concurrent networking library for Python that allows you to change how you run your code, not how you write it.
It's easy to get started using Eventlet, and easy to convert existing applications to use it. Start off by looking at examples, common design patterns, and the list of the basic API primitives.
License: MIT
Currently CPython 2.7 and 3.4+ are supported, but 2.7 and 3.4 support is deprecated and will be removed in the future, only CPython 3.5+ support will remain.
To install latest PyPI release:
pip install eventlet
Manually lock version in requirements, if your build/development process doesn't automate it:
# requirements.txt
eventlet==x.y
Eventlet team is commited to have only stable code in master branch, so recommended way to install is from latest master commit:
pip install https://github.com/eventlet/eventlet/archive/master.zip
Beware, http…zip link in requirements.txt will repeat download and installation even if you specify link to particular commit.
Earlier versions available at Eventlet on PyPI
Development, issue tracking happens at Eventlet on Github
We had Mercurial repository on Bitbucket, but it's not used anymore.
subsystem: description of why the change is useful optional details links to related issues or websitesThe why part is very important. Diff already says what you have done. But nobody knows why.
If you don't like these rules, raw patches are more than welcome!
Please be sure to report bugs as effectively as possible, to ensure that we understand and act on them quickly.
Usually open issue at Github
In special cases, to contact current maintainers directly, look up info on Github project page.
This is a simple web “crawler” that fetches a bunch of urls using a coroutine pool. It has as much concurrency (i.e. pages being fetched simultaneously) as coroutines in the pool.
import eventlet
# note: this urllib import doesn't work in Python2
from eventlet.green.urllib.request import urlopen
urls = [
"http://www.google.com/intl/en_ALL/images/logo.gif",
"https://wiki.secondlife.com/w/images/secondlife.jpg",
"http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif",
]
def fetch(url):
return urlopen(url).read()
pool = eventlet.GreenPool()
for body in pool.imap(fetch, urls):
print("got body", len(body))