Skip to main content

Lightweight in-process concurrent programming

Project description

https://github.com/python-greenlet/greenlet/workflows/tests/badge.svg

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).

Greenlets are provided as a C extension module for the regular unmodified interpreter.

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:

pip install greenlet

Source code archives and binary distributions are available on the python package index at https://pypi.org/project/greenlet

The source code repository is hosted on github: https://github.com/python-greenlet/greenlet

Documentation is available on readthedocs.org: https://greenlet.readthedocs.io

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

greenlet-3.0.0rc3.tar.gz (174.7 kB view hashes)

Uploaded Source

Built Distributions

greenlet-3.0.0rc3-cp312-universal2-macosx_10_9_universal2.whl (267.4 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

greenlet-3.0.0rc3-cp312-cp312-win_amd64.whl (288.5 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

greenlet-3.0.0rc3-cp312-cp312-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp312-cp312-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (620.6 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (665.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl (667.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (670.9 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (655.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

greenlet-3.0.0rc3-cp311-universal2-macosx_10_9_universal2.whl (266.8 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

greenlet-3.0.0rc3-cp311-cp311-win_amd64.whl (288.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

greenlet-3.0.0rc3-cp311-cp311-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp311-cp311-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (616.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (663.9 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl (660.8 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (670.0 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (653.6 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

greenlet-3.0.0rc3-cp310-universal2-macosx_11_0_x86_64.whl (265.4 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ x86-64

greenlet-3.0.0rc3-cp310-cp310-win_amd64.whl (287.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

greenlet-3.0.0rc3-cp310-cp310-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp310-cp310-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (613.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (657.8 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl (656.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (664.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (647.9 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

greenlet-3.0.0rc3-cp39-universal2-macosx_11_0_x86_64.whl (264.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ x86-64

greenlet-3.0.0rc3-cp39-cp39-win_amd64.whl (287.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

greenlet-3.0.0rc3-cp39-cp39-win32.whl (269.1 kB view hashes)

Uploaded CPython 3.9 Windows x86

greenlet-3.0.0rc3-cp39-cp39-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp39-cp39-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (610.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (657.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl (655.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (663.8 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (647.3 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

greenlet-3.0.0rc3-cp38-universal2-macosx_11_0_x86_64.whl (264.4 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ x86-64

greenlet-3.0.0rc3-cp38-cp38-win_amd64.whl (286.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

greenlet-3.0.0rc3-cp38-cp38-win32.whl (340.4 kB view hashes)

Uploaded CPython 3.8 Windows x86

greenlet-3.0.0rc3-cp38-cp38-musllinux_1_1_x86_64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp38-cp38-musllinux_1_1_aarch64.whl (1.2 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (617.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (663.0 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl (661.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (668.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (653.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

greenlet-3.0.0rc3-cp37-universal2-macosx_11_0_x86_64.whl (262.9 kB view hashes)

Uploaded CPython 3.7 macOS 11.0+ x86-64

greenlet-3.0.0rc3-cp37-cp37m-win_amd64.whl (287.5 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

greenlet-3.0.0rc3-cp37-cp37m-win32.whl (341.8 kB view hashes)

Uploaded CPython 3.7m Windows x86

greenlet-3.0.0rc3-cp37-cp37m-musllinux_1_1_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

greenlet-3.0.0rc3-cp37-cp37m-musllinux_1_1_aarch64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ ARM64

greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (568.8 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64 manylinux: glibc 2.28+ x86-64

greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (618.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl (619.4 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ s390x

greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (628.5 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ppc64le

greenlet-3.0.0rc3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (610.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page