Skip to main content

build status pypiv pyversions wheel license

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

  1. Active greenify before initiate environment:

    import greenify
    greenify.greenify()
  2. Make sure the dynamic module(e.g. libmemcached) is patched before using:

    assert greenify.patch_lib('/usr/lib/libmemcached.so')
  3. Import and use the corresponding module, which is now gevent compatible.

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)

Source distribution for greenify 0.5.0
File Size Uploaded
greenify-0.5.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for greenify 0.5.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.4

7 release files

0.4.3

6 release files

0.4.2

6 release files

0.4.1

6 release files

0.4.0

6 release files

0.3.4

13 release files

0.3.3

7 release files

0.3.2

4 release files

0.3.1

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page