greenify can make Python extension modules having network operations in C code to be compatible with gevent.
greenify uses the Dynamic Function Redirecting technique same as ELF-Hook to patch blocking network operations at runtime, without the need modify the original modules.
Currently greenify only supports ELF format modules, and is tested on Linux.
Install from source
greenify module is installed using setuptools or pip:
python setup.py install
or:
pip install greenify
Usage
Thread Safety
Once activated, the green C functions will, on potentially blocking operation, pass control to gevent’s main event loop, which may switch to other ready greenlet which is also in one of the green functions. So, make sure your C code can handle this kind of execution pause and resume. A thread safe program usually is ready for greenify, but remember that all the switches happen in a single thread.
License
greenify is written and maintained by douban and is licensed under New BSD license.
Metadata
Release files for greenify 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| greenify-0.5.0.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| greenify-0.5.0-cp39-abi3-manylinux_2_34_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.34+ x86-64 | Details |
Total release size: 163.8 kB
Release files / greenify-0.5.0.tar.gz
| Download URL | greenify-0.5.0.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0c407839e6d9d1974dca3ba91d4b21e4cdda08ac35caebc58a349b646274568
|
|
BLAKE2b-256 checksum How to use checksums |
43a04b9ac3becaa52b1b8c1be4abef4f5f4b4c3cc702669adb94b41d08ce5287
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / greenify-0.5.0-cp39-abi3-manylinux_2_34_x86_64.whl
| Download URL | greenify-0.5.0-cp39-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 153.7 kB |
| Tags | CPython 3.9 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
087711c1b24b47ab86bd7ceeaf9a93f4896b4da072bc9a1875c7f206bdf31e55
|
|
BLAKE2b-256 checksum How to use checksums |
742f5159daec5e839630698c53a762b9a0e5dd347a7c5189545e620d8d188dde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|