README.rst 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .. image:: https://secure.travis-ci.org/python-greenlet/greenlet.png
  2. :target: http://travis-ci.org/python-greenlet/greenlet
  3. The greenlet package is a spin-off of Stackless, a version of CPython
  4. that supports micro-threads called "tasklets". Tasklets run
  5. pseudo-concurrently (typically in a single or a few OS-level threads)
  6. and are synchronized with data exchanges on "channels".
  7. A "greenlet", on the other hand, is a still more primitive notion of
  8. micro-thread with no implicit scheduling; coroutines, in other
  9. words. This is useful when you want to control exactly when your code
  10. runs. You can build custom scheduled micro-threads on top of greenlet;
  11. however, it seems that greenlets are useful on their own as a way to
  12. make advanced control flow structures. For example, we can recreate
  13. generators; the difference with Python's own generators is that our
  14. generators can call nested functions and the nested functions can
  15. yield values too. Additionally, you don't need a "yield" keyword. See
  16. the example in tests/test_generator.py.
  17. Greenlets are provided as a C extension module for the regular
  18. unmodified interpreter.
  19. Greenlets are lightweight coroutines for in-process concurrent
  20. programming.
  21. Who is using Greenlet?
  22. ======================
  23. There are several libraries that use Greenlet as a more flexible
  24. alternative to Python's built in coroutine support:
  25. - `Concurrence`_
  26. - `Eventlet`_
  27. - `Gevent`_
  28. .. _Concurrence: http://opensource.hyves.org/concurrence/
  29. .. _Eventlet: http://eventlet.net/
  30. .. _Gevent: http://www.gevent.org/
  31. Getting Greenlet
  32. ================
  33. The easiest way to get Greenlet is to install it with pip or
  34. easy_install::
  35. pip install greenlet
  36. easy_install greenlet
  37. Source code archives and windows installers are available on the
  38. python package index at https://pypi.python.org/pypi/greenlet
  39. The source code repository is hosted on github:
  40. https://github.com/python-greenlet/greenlet
  41. Documentation is available on readthedocs.org:
  42. https://greenlet.readthedocs.io