| 1 |
Eventlet Documentation |
| 2 |
###################### |
| 3 |
|
| 4 |
Warning |
| 5 |
======= |
| 6 |
|
| 7 |
**New usages of eventlet are now heavily discouraged! Please read the |
| 8 |
following.** |
| 9 |
|
| 10 |
Eventlet was created almost 18 years ago, at a time where async |
| 11 |
features were absent from the CPython stdlib. With time eventlet evolved and |
| 12 |
CPython too, but since several years the maintenance activity of eventlet |
| 13 |
decreased leading to a growing gap between eventlet and the CPython |
| 14 |
implementation. |
| 15 |
|
| 16 |
This gap is now too high and can lead you to unexpected side effects and bugs |
| 17 |
in your applications. |
| 18 |
|
| 19 |
Eventlet now follows a new maintenance policy. **Only maintenance for |
| 20 |
stability and bug fixing** will be provided. **No new features will be |
| 21 |
accepted**, except those related to the asyncio migration. **Usages in new |
| 22 |
projects are discouraged**. **Our goal is to plan the retirement of eventlet** |
| 23 |
and to give you ways to move away from eventlet. |
| 24 |
|
| 25 |
If you are looking for a library to manage async network programming, |
| 26 |
and if you do not yet use eventlet, then, we encourage you to use `asyncio`_, |
| 27 |
which is the official async library of the CPython stdlib. |
| 28 |
|
| 29 |
If you already use eventlet, we hope to enable migration to asyncio for some use |
| 30 |
cases; see :ref:`migration-guide`. Only new features related to the migration |
| 31 |
solution will be accepted. |
| 32 |
|
| 33 |
If you have questions concerning maintenance goals or concerning |
| 34 |
the migration do not hesitate to `open a new issue`_, we will be happy to |
| 35 |
answer them. |
| 36 |
|
| 37 |
.. _asyncio: https://docs.python.org/3/library/asyncio.html |
| 38 |
.. _open a new issue: https://github.com/eventlet/eventlet/issues/new |
| 39 |
|
| 40 |
Installation |
| 41 |
============ |
| 42 |
|
| 43 |
The easiest way to get Eventlet is to use pip:: |
| 44 |
|
| 45 |
pip install -U eventlet |
| 46 |
|
| 47 |
To install latest development version once:: |
| 48 |
|
| 49 |
pip install -U https://github.com/eventlet/eventlet/archive/master.zip |
| 50 |
|
| 51 |
Usage |
| 52 |
===== |
| 53 |
|
| 54 |
Code talks! This is a simple web crawler that fetches a bunch of urls concurrently: |
| 55 |
|
| 56 |
.. code-block:: python |
| 57 |
|
| 58 |
urls = [ |
| 59 |
"http://www.google.com/intl/en_ALL/images/logo.gif", |
| 60 |
"http://python.org/images/python-logo.gif", |
| 61 |
"http://us.i1.yimg.com/us.yimg.com/i/ww/beta/y3.gif", |
| 62 |
] |
| 63 |
|
| 64 |
import eventlet |
| 65 |
from eventlet.green.urllib.request import urlopen |
| 66 |
|
| 67 |
def fetch(url): |
| 68 |
return urlopen(url).read() |
| 69 |
|
| 70 |
pool = eventlet.GreenPool() |
| 71 |
for body in pool.imap(fetch, urls): |
| 72 |
print("got body", len(body)) |
| 73 |
|
| 74 |
Supported Python Versions |
| 75 |
========================= |
| 76 |
|
| 77 |
Currently supporting CPython 3.9+. |
| 78 |
|
| 79 |
|
| 80 |
Concepts & References |
| 81 |
===================== |
| 82 |
|
| 83 |
.. toctree:: |
| 84 |
:maxdepth: 2 |
| 85 |
|
| 86 |
asyncio/asyncio |
| 87 |
basic_usage |
| 88 |
design_patterns |
| 89 |
patching |
| 90 |
examples |
| 91 |
ssl |
| 92 |
threading |
| 93 |
zeromq |
| 94 |
hubs |
| 95 |
environment |
| 96 |
fork |
| 97 |
modules |
| 98 |
|
| 99 |
Want to contribute? |
| 100 |
=================== |
| 101 |
|
| 102 |
.. toctree:: |
| 103 |
:maxdepth: 2 |
| 104 |
|
| 105 |
contribute |
| 106 |
testing |
| 107 |
maintenance |
| 108 |
|
| 109 |
License |
| 110 |
======= |
| 111 |
Eventlet is made available under the terms of the open source `MIT license <http://www.opensource.org/licenses/mit-license.php>`_ |
| 112 |
|
| 113 |
Changelog |
| 114 |
========= |
| 115 |
|
| 116 |
For further details about released versions of Eventlet please take a |
| 117 |
look at the `changelog`_. |
| 118 |
|
| 119 |
Authors & History |
| 120 |
================= |
| 121 |
|
| 122 |
You have questions or you may have find a bug and you want to contact authors |
| 123 |
or maintainers, then please take a look at :ref:`authors`. |
| 124 |
|
| 125 |
You want to learn more about the history of Eventlet, then, please take a |
| 126 |
look at :ref:`history`. |
| 127 |
|
| 128 |
Indices and tables |
| 129 |
================== |
| 130 |
|
| 131 |
* :ref:`genindex` |
| 132 |
* :ref:`modindex` |
| 133 |
* :ref:`search` |
| 134 |
* `changelog`_ |
| 135 |
|
| 136 |
|
| 137 |
.. _changelog: https://github.com/eventlet/eventlet/blob/master/NEWS |