greenlet
Lightweight in-process concurrent programming
Install
greenlet on PyPI
pip
pip install greenletuv
uv add greenletpoetry
poetry add greenletPackage facts
| License | MIT AND PSF-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 3 days since the last release |
| Last repo commit | |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: greenlet-3.5.5-cp310-cp310-macosx_11_0_universal2.whl; greenlet-3.5.5-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; greenlet-3.5.5-cp310-cp310-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl; greenlet-3.5.5-cp310-cp310-manylinux_2_24_s390x.manylinux_2_28_s390x.whl; greenlet-3.5.5-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; greenlet-3.5.5-cp310-cp310-manylinux_2_39_riscv64.whl; greenlet-3.5.5-cp310-cp310-musllinux_1_2_aarch64.whl; greenlet-3.5.5-cp310-cp310-musllinux_1_2_x86_64.whl; greenlet-3.5.5-cp310-cp310-win_amd64.whl; greenlet-3.5.5-cp311-cp311-macosx_11_0_universal2.whl; greenlet-3.5.5-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; greenlet-3.5.5-cp311-cp311-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl; greenlet-3.5.5-cp311-cp311-manylinux_2_24_s390x.manylinux_2_28_s390x.whl; greenlet-3.5.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; greenlet-3.5.5-cp311-cp311-manylinux_2_39_riscv64.whl; greenlet-3.5.5-cp311-cp311-musllinux_1_2_aarch64.whl; greenlet-3.5.5-cp311-cp311-musllinux_1_2_x86_64.whl; greenlet-3.5.5-cp311-cp311-win_amd64.whl; greenlet-3.5.5-cp311-cp311-win_arm64.whl; greenlet-3.5.5-cp312-cp312-macosx_11_0_universal2.whl
Keywords: greenlet, coroutine, concurrency, threads, cooperative
About greenlet
from the package's own PyPI description — quoted content, verbatim
.. This file is included into docs/history.rst
Greenlets are lightweight coroutines for in-process concurrent programming.
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 test_generator.py
<https://github.com/python-greenlet/greenlet/blob/adca19bf1f287b3395896a8f41f3f4fd1797fdc7/src/greenlet/tests/test_generator.py#L1>_).
Greenlets are provided...
Read as markdown · JSON record · Source repository · Homepage · Docs
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
Greenlet provides lightweight coroutines for in-process concurrent programming, enabling you to build custom micro-threads with explicit control flow without relying on the operating system's threading.
Medium install friction due to compiled C extension wheels across many platforms (Python 3.10–3.15, macOS, Linux variants, Windows). Maintenance is active with a recent release (3 days old) and ongoing repository activity, reducing long-term risk.
Dual-licensed under MIT and PSF-2.0, both permissive licenses. You may use, modify, and distribute greenlet freely in commercial and private projects with minimal restrictions.
Usage
pip install greenlet
from greenlet import greenlet
def test1():
print("test1 1")
gr2.switch()
print("test1 2")
def test2():
print("test2 1")
gr1.switch()
print("test2 2")
gr1 = greenlet(test1)
gr2 = greenlet(test2)
gr1.switch()
Requires Python >=3.10. C compiler needed to build from source on platforms without pre-built wheels.
Verdict: Greenlet is a stable, actively maintained library (top 100 PyPI, no known vulnerabilities) offering a proven foundation for building concurrent systems with explicit control flow. The permissive dual MIT/PSF-2.0 license poses no legal friction. Medium install friction from C extension compilation is typical and manageable for most environments.
Needs verification
- Whether pre-built wheels cover your specific platform/architecture combination (though coverage is extensive).
- Performance characteristics and memory overhead compared to asyncio or threading for your specific workload.
Similar packages
permissive · top 1,000 on PyPI
geventpermissive · top 1,000 on PyPI
ijsonpermissive · top 1,000 on PyPI
uncalled-forpermissive · top 1,000 on PyPI
multitaskingpermissive · top 1,000 on PyPI
APSchedulerpermissive · top 1,000 on PyPI
execnetpermissive · top 1,000 on PyPI
pytest-asynciopermissive · top 1,000 on PyPI
lupapermissive · top 1,000 on PyPI
opencensus-contextpermissive · top 1,000 on PyPI