{"id":22914487,"url":"https://github.com/karellen/geventmp","last_synced_at":"2025-08-12T09:30:51.644Z","repository":{"id":35065482,"uuid":"202218534","full_name":"karellen/geventmp","owner":"karellen","description":"GeventMP - Gevent Multiprocessing Extension","archived":false,"fork":false,"pushed_at":"2024-12-30T14:15:51.000Z","size":113,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-19T20:53:29.255Z","etag":null,"topics":["gevent","monkey-patching","multiprocessing","non-blocking-io","non-blocking-sockets","python","python-multiprocessing"],"latest_commit_sha":null,"homepage":"https://github.com/karellen/geventmp","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karellen.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-13T20:25:05.000Z","updated_at":"2024-12-30T14:13:15.000Z","dependencies_parsed_at":"2024-10-28T23:29:15.427Z","dependency_job_id":null,"html_url":"https://github.com/karellen/geventmp","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":0.06896551724137934,"last_synced_commit":"b35088b5c67f563d7b3fdd2b3cf58dd461e05073"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/karellen/geventmp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karellen%2Fgeventmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karellen%2Fgeventmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karellen%2Fgeventmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karellen%2Fgeventmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karellen","download_url":"https://codeload.github.com/karellen/geventmp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karellen%2Fgeventmp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267016523,"owners_count":24021821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gevent","monkey-patching","multiprocessing","non-blocking-io","non-blocking-sockets","python","python-multiprocessing"],"created_at":"2024-12-14T05:15:18.584Z","updated_at":"2025-08-12T09:30:51.342Z","avatar_url":"https://github.com/karellen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============================================\n GeventMP_ - Gevent_ Multiprocessing Extension\n===============================================\n\n.. image:: https://img.shields.io/gitter/room/karellen/Lobby?logo=gitter\n   :target: https://app.gitter.im/#/room/#karellen_Lobby:gitter.im\n   :alt: Gitter\n.. image:: https://img.shields.io/github/actions/workflow/status/karellen/geventmp/build.yml?branch=master\n   :target: https://github.com/karellen/geventmp/actions/workflows/build.yml\n   :alt: Build Status\n.. image:: https://img.shields.io/coveralls/github/karellen/geventmp/master?logo=coveralls\n   :target: https://coveralls.io/r/karellen/geventmp?branch=master\n   :alt: Coverage Status\n\n|\n\n.. image:: https://img.shields.io/pypi/v/geventmp?logo=pypi\n   :target: https://pypi.org/project/geventmp/\n   :alt: GeventMP Version\n.. image:: https://img.shields.io/pypi/pyversions/geventmp?logo=pypi\n   :target: https://pypi.org/project/geventmp/\n   :alt: GeventMP Python Versions\n.. image:: https://img.shields.io/pypi/dd/geventmp?logo=pypi\n   :target: https://pypi.org/project/geventmp/\n   :alt: GeventMP Downloads Per Day\n.. image:: https://img.shields.io/pypi/dw/geventmp?logo=pypi\n   :target: https://pypi.org/project/geventmp/\n   :alt: GeventMP Downloads Per Week\n.. image:: https://img.shields.io/pypi/dm/geventmp?logo=pypi\n   :target: https://pypi.org/project/geventmp/\n   :alt: GeventMP Downloads Per Month\n\n|\n\n.. warning::\n    HIC SUNT DRACONES!!!\n\n    This code is experimental (beta). There is some testing, but a lots of things are in flux, and\n    some platforms don't work at all.\n\n    You MAY try to use this in production with the understanding that this is a beta-quality software.\n\n    That said, this code may crash your server, bankrupt your company, burn your house down and be mean\n    to your puppy.\n\n    You've been warned.\n\nProblem\n=======\n\nDue to internal implementation, `multiprocessing` (`MP`) is unsafe to use with Gevent_ even when `monkey-patched`__.\nNamely, the use of OS semaphore primitives and inter-process IO in `MP` will cause the main\nloop to stall/deadlock/block (specific issue depends on the version of CPython).\n\n__ monkey_\n\nSolution\n========\nGeventMP_ (`Gee-vent Em-Pee`) is a gevent_ multiprocessing extension plugin for the `monkey-patching`__ subsystem.\nAs with the rest of the monkey patch subsystem the process is fairly clear:\n\n__ monkey_\n\n1. Identify all places where blocking occurs and where it may stall the loop.\n2. If blocking occurs on a file descriptor (`FD`), try to convert the file descriptor from blocking to non-blocking\n   (sockets/pipes/fifos, sometimes even files where, rarely, appropriate) and replace blocking IO functions with their\n   gevent_ non-blocking equivalents.\n3. If blocking occurs in a Python/OS primitive that does not support non-blocking access and thus cannot be geventized,\n   wrap all blocking access to that primitive with native thread-pool-based wrappers and call it a day (while fully\n   understanding that primitive access latency will increase and raw performance may suffer as a result).\n4. If you are really brave and have lots of free time on your hands, completely replace a standard blocking Python\n   non-`FD`-based primitive with implementation based on an `FD`-based OS primitive (e.g. POSIX semaphore =\u003e\n   Linux `eventfd-based semaphore for kernels \u003e 2.6.30`__).\n5. Due to launching of separate processes in `MP`, figure out how, when, and whether to `monkey-patch`__ spawned/forked\n   children and grandchildren.\n\n__ eventfd_\n\n__ monkey_\n\nInstallation\n============\nThe package is hosted on PyPi_.\n\nFor stable version:\n\n.. code-block:: bash\n\n  pip install geventmp\n\nFor unstable version:\n\n.. code-block:: bash\n\n  pip install --pre geventmp\n\n\nOnce installed, `GeventMP`_ will activate by default in the below stanza.\n\n.. code-block:: python\n\n   from gevent.monkey import patch_all\n   patch_all()\n\nIf you would like `GeventMP`_ to not activate by default, either do not install it or explicitly disable it:\n\n.. code-block:: python\n\n   from gevent.monkey import patch_all\n   patch_all(geventmp=False)\n\nThat's it - there are no other flags, settings, properties or config values so far.\n\nSupported Platforms\n===================\n\n.. note::\n    All claims of support may not be real at all. You're welcome to experiment. See warnings on top.\n\n* Linux and Darwin.\n* CPython 3.9, 3.10, 3.11, 3.12, 3.13\n* PyPy 3.9, 3.10\n\nKnown Issues\n============\n\n* Multiprocessing `forkserver` works in GeventMP_, but the spawned child isn't green.\n\nTODO\n====\n1. Monkey patch Windows to the extent possible.\n2. Lots of applications use `Billiard \u003chttps://github.com/celery/billiard\u003e`_ for multiprocessing instead of stock Python\n   package. Consider monkey patching Billiard if detected.\n\nContact Us\n==========\n\nPost feedback and issues on the `Bug Tracker`_, `Gitter`_,\nand `Twitter (@karelleninc)`_.\n\n.. _Gevent: https://github.com/gevent/gevent/\n.. _geventmp: https://github.com/karellen/geventmp\n.. _bug tracker: https://github.com/karellen/geventmp/issues\n.. _gitter: https://gitter.im/karellen/Lobby\n.. _twitter (@karelleninc): https://twitter.com/karelleninc\n.. _monkey: https://en.wikipedia.org/wiki/Monkey_patch\n.. _eventfd: https://linux.die.net/man/2/eventfd\n.. _pypi: https://pypi.org/project/geventmp/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarellen%2Fgeventmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarellen%2Fgeventmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarellen%2Fgeventmp/lists"}