Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

GeventMP - Gevent Multiprocessing Extension

Gitter Build Status Coverage Status

GeventMP Version GeventMP Python Versions GeventMP Downloads Per Day GeventMP Downloads Per Week GeventMP Downloads Per Month

Problem

Due to internal implementation, multiprocessing (MP) is unsafe to use with Gevent even when monkey-patched. Namely, the use of OS semaphore primitives and inter-process IO in MP will cause the main loop to stall/deadlock/block (specific issue depends on the version of CPython).

Solution

GeventMP (Gee-vent Em-Pee) is a gevent multiprocessing extension plugin for the monkey-patching subsystem. As with the rest of the monkey patch subsystem the process is fairly clear:

  1. Identify all places where blocking occurs and where it may stall the loop.

  2. If blocking occurs on a file descriptor (FD), try to convert the file descriptor from blocking to non-blocking (sockets/pipes/fifos, sometimes even files where, rarely, appropriate) and replace blocking IO functions with their gevent non-blocking equivalents.

  3. If blocking occurs in a Python/OS primitive that does not support non-blocking access and thus cannot be geventized, wrap all blocking access to that primitive with native thread-pool-based wrappers and call it a day (while fully understanding that primitive access latency will increase and raw performance may suffer as a result).

  4. If you are really brave and have lots of free time on your hands, completely replace a standard blocking Python non-FD-based primitive with implementation based on an FD-based OS primitive (e.g. POSIX semaphore => Linux eventfd-based semaphore for kernels > 2.6.30).

  5. Due to launching of separate processes in MP, figure out how, when, and whether to monkey-patch spawned/forked children and grandchildren.

Installation

The package is hosted on PyPi.

For stable version:

pip install geventmp

For unstable version:

pip install --pre geventmp

Once installed, GeventMP will activate by default in the below stanza.

from gevent.monkey import patch_all
patch_all()

If you would like GeventMP to not activate by default, either do not install it or explicitly disable it:

from gevent.monkey import patch_all
patch_all(geventmp=False)

That’s it - there are no other flags, settings, properties or config values so far.

Supported Platforms

  • Linux and Darwin.

  • CPython 3.9, 3.10, 3.11, 3.12, 3.13

  • PyPy 3.9, 3.10

TODO

  1. Monkey patch Windows to the extent possible.

  2. Lots of applications use Billiard for multiprocessing instead of stock Python package. Consider monkey patching Billiard if detected.

Contact Us

Post feedback and issues on the Bug Tracker, Gitter, and Twitter (@karelleninc).

Metadata

Release files for geventmp 0.0.11.dev20260308034434

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geventmp 0.0.11.dev20260308034434
File Size Uploaded Provenance Actions
geventmp-0.0.11.dev20260308034434.tar.gz 16.2 kB Without provenance Details for geventmp-0.0.11.dev20260308034434.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geventmp 0.0.11.dev20260308034434
File Interpreter ABI Platform Actions
geventmp-0.0.11.dev20260308034434-py3-none-any.whl Python 3 none any Details for geventmp-0.0.11.dev20260308034434-py3-none-any.whl

Total release size: 38.5 kB

Release files / geventmp-0.0.11.dev20260308034434.tar.gz

Download URL geventmp-0.0.11.dev20260308034434.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f78eeaaba0e147204f5d403040299fb95932737a725860637d1eb7eb294edbcd
BLAKE2b-256 checksum
How to use checksums
7802e2cd3d207350e152db89f88b789a1adcb89a41af2d262153c367364d2c3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / geventmp-0.0.11.dev20260308034434-py3-none-any.whl

Download URL geventmp-0.0.11.dev20260308034434-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98ffa6fc2fd83f7339882236d4ae1f1f728345d649bbbadc758d95762f8375ed
BLAKE2b-256 checksum
How to use checksums
e33da152bc7d1151fb5b637d399a55672465ca669085a55dde0ee36ee3ae3eab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Security for geventmp 0.0.11.dev20260308034434

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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