Lightweight in-process concurrent programming
Project description
The greenlet package is a spin-off of Stackless, a version of CPython that supports micro-threads called “tasklets”. Tasklets run pseudo-concurrently (typically in a single or a few OS-level threads) and are synchronized with data exchanges on “channels”.
A “greenlet”, on the other hand, is a still more primitive notion of micro-thread with no implicit scheduling; coroutines, in other words. This is useful when you want to control exactly when your code runs. You can build custom scheduled micro-threads on top of greenlet; however, it seems that greenlets are useful on their own as a way to make advanced control flow structures. For example, we can recreate generators; the difference with Python’s own generators is that our generators can call nested functions and the nested functions can yield values too. Additionally, you don’t need a “yield” keyword. See the example in tests/test_generator.py.
Greenlets are provided as a C extension module for the regular unmodified interpreter.
Greenlets are lightweight coroutines for in-process concurrent programming.
Who is using Greenlet?
There are several libraries that use Greenlet as a more flexible alternative to Python’s built in coroutine support:
Getting Greenlet
The easiest way to get Greenlet is to install it with pip or easy_install:
pip install greenlet easy_install greenlet
Source code archives and windows installers are available on the python package index at http://pypi.python.org/pypi/greenlet
The source code repository is hosted on github: https://github.com/python-greenlet/greenlet
The master branch - i.e. the development version - can be installed directly by running one of the following:
pip install greenlet==dev easy_install greenlet==dev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for greenlet-0.3.3.win-amd64-py3.2.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36b83edd1e8ca7380de9459b03190f12ec044478153d1c52315e24d1e25ce359 |
|
MD5 | 6e0e969e4d13976f879fa250ddeb7826 |
|
BLAKE2b-256 | 4e01ce26ab3d351daf803853fceb602d3ea1b47a18cafa14d794e46f86691421 |
Hashes for greenlet-0.3.3.win-amd64-py3.1.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb52ce3c7fca16cffaf7783dd3080009d1733bcdf0087ecd4a53f68dd16d9172 |
|
MD5 | 9dd017b0f0e288bf8dd074b9a5d7f08d |
|
BLAKE2b-256 | 4333fe37b893aad46588659f76cb75a6a8638d27f2262766208d86703b8b9b9d |
Hashes for greenlet-0.3.3.win-amd64-py2.7.exe
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a249f6a44527e69698805bb0b92437eb27aa74c44225b8c7df49df8e3a4eb9d |
|
MD5 | 366229fe0749548c6a48e470318fcbb7 |
|
BLAKE2b-256 | c953ae199f9193a6e9db506892b3ed9fcd69e39c5fdd0f03d6ee4a06c129f608 |
Hashes for greenlet-0.3.3-py3.1-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2fc32839c9e6093dba59d6434b60fc3dceac2fbbc52e0e2e7e6355eff714acd |
|
MD5 | 1082d000b1be4b85facd569a45a6afbe |
|
BLAKE2b-256 | 1d4d0a69ebbfed3514901e76fa647146b276be34ad43287cfe66e18292638d5a |
Hashes for greenlet-0.3.3-py2.7-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bb88bd9b6fbd7940407c7ab7c4b501271d1de0449ebb501efdcf79d1733496f |
|
MD5 | 5c4df4c17616b5fe6ae126ead01f84b0 |
|
BLAKE2b-256 | ea69dfb6f6b0419c5a9995f7ad22de22a4fbb910a9b8384d94817fb464570277 |