nest-asyncio-adv


Namenest-asyncio-adv JSON
Version 1.7.0b0 PyPI version JSON
download
home_pagehttps://github.com/ufoptg/asyncNestADV
SummaryPatch asyncio to allow nested event loops
upload_time2024-04-13 02:43:20
maintainerNone
docs_urlNone
authorufoptg
requires_python>=3.5
licenseGNUv3
keywords asyncio nested eventloop
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            |Status|

Introduction
------------

By design asyncio `does not allow <https://github.com/python/cpython/issues/66435>`_
its event loop to be nested. This presents a practical problem:
When in an environment where the event loop is
already running it's impossible to run tasks and wait
for the result. Trying to do so will give the error
"``RuntimeError: This event loop is already running``".

The issue pops up in various environments, such as web servers,
GUI applications and in Jupyter notebooks.

This module patches asyncio to allow nested use of ``asyncio.run`` and
``loop.run_until_complete``.

Installation
------------

.. code-block::

    pip3 install git+https://github.com/ufoptg/asyncNestADV.git

Python 3.5 or higher is required.

Usage
-----

.. code-block:: python

    import nest_asyncio
    nest_asyncio.apply()
    nest_asyncio.revert()

Optionally the specific loop that needs patching can be given
as argument to ``apply``, otherwise the current event loop is used.
An event loop can be patched whether it is already running
or not. Only event loops from asyncio can be patched;
Loops from other projects, such as uvloop or quamash,
generally can't be patched.


.. |Status| image:: https://img.shields.io/badge/status-stable-green.svg
   :alt:

.. |License| image:: https://img.shields.io/badge/license-BSD-blue.svg
   :alt:


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ufoptg/asyncNestADV",
    "name": "nest-asyncio-adv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.5",
    "maintainer_email": null,
    "keywords": "asyncio, nested, eventloop",
    "author": "ufoptg",
    "author_email": "de.wit@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/29/28/2ad79a336dc8431ff06a38b4e24c3aadb1f983c23d50bbfd3254aaf5af6e/nest_asyncio_adv-1.7.0b0.tar.gz",
    "platform": null,
    "description": "|Status|\n\nIntroduction\n------------\n\nBy design asyncio `does not allow <https://github.com/python/cpython/issues/66435>`_\nits event loop to be nested. This presents a practical problem:\nWhen in an environment where the event loop is\nalready running it's impossible to run tasks and wait\nfor the result. Trying to do so will give the error\n\"``RuntimeError: This event loop is already running``\".\n\nThe issue pops up in various environments, such as web servers,\nGUI applications and in Jupyter notebooks.\n\nThis module patches asyncio to allow nested use of ``asyncio.run`` and\n``loop.run_until_complete``.\n\nInstallation\n------------\n\n.. code-block::\n\n    pip3 install git+https://github.com/ufoptg/asyncNestADV.git\n\nPython 3.5 or higher is required.\n\nUsage\n-----\n\n.. code-block:: python\n\n    import nest_asyncio\n    nest_asyncio.apply()\n    nest_asyncio.revert()\n\nOptionally the specific loop that needs patching can be given\nas argument to ``apply``, otherwise the current event loop is used.\nAn event loop can be patched whether it is already running\nor not. Only event loops from asyncio can be patched;\nLoops from other projects, such as uvloop or quamash,\ngenerally can't be patched.\n\n\n.. |Status| image:: https://img.shields.io/badge/status-stable-green.svg\n   :alt:\n\n.. |License| image:: https://img.shields.io/badge/license-BSD-blue.svg\n   :alt:\n\n",
    "bugtrack_url": null,
    "license": "GNUv3",
    "summary": "Patch asyncio to allow nested event loops",
    "version": "1.7.0b0",
    "project_urls": {
        "Homepage": "https://github.com/ufoptg/asyncNestADV"
    },
    "split_keywords": [
        "asyncio",
        " nested",
        " eventloop"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84e0326b2d265141e1ae388ee51b59de4082848c8fa5263d7ce28340b97b9b95",
                "md5": "abcf4de938b170fa2a2069986cf010f3",
                "sha256": "f5f75f16fb8c5f53fc0297cb95f5c30602f673c033e25f36a7a973e383abfb03"
            },
            "downloads": -1,
            "filename": "nest_asyncio_adv-1.7.0b0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "abcf4de938b170fa2a2069986cf010f3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5",
            "size": 16408,
            "upload_time": "2024-04-13T02:43:18",
            "upload_time_iso_8601": "2024-04-13T02:43:18.865308Z",
            "url": "https://files.pythonhosted.org/packages/84/e0/326b2d265141e1ae388ee51b59de4082848c8fa5263d7ce28340b97b9b95/nest_asyncio_adv-1.7.0b0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "29282ad79a336dc8431ff06a38b4e24c3aadb1f983c23d50bbfd3254aaf5af6e",
                "md5": "069a2edd033de96446691e80fe48e346",
                "sha256": "2580c8021371c311adba6bac0f10ceda4834af2c22a71bcd65ec2d3d1609a678"
            },
            "downloads": -1,
            "filename": "nest_asyncio_adv-1.7.0b0.tar.gz",
            "has_sig": false,
            "md5_digest": "069a2edd033de96446691e80fe48e346",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5",
            "size": 19568,
            "upload_time": "2024-04-13T02:43:20",
            "upload_time_iso_8601": "2024-04-13T02:43:20.655303Z",
            "url": "https://files.pythonhosted.org/packages/29/28/2ad79a336dc8431ff06a38b4e24c3aadb1f983c23d50bbfd3254aaf5af6e/nest_asyncio_adv-1.7.0b0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-13 02:43:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ufoptg",
    "github_project": "asyncNestADV",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nest-asyncio-adv"
}
        
Elapsed time: 3.16613s