METADATA 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. Metadata-Version: 2.1
  2. Name: nest-asyncio
  3. Version: 1.6.0
  4. Summary: Patch asyncio to allow nested event loops
  5. Home-page: https://github.com/erdewit/nest_asyncio
  6. Author: Ewald R. de Wit
  7. Author-email: ewald.de.wit@gmail.com
  8. License: BSD
  9. Keywords: asyncio,nested,eventloop
  10. Classifier: Development Status :: 5 - Production/Stable
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: BSD License
  13. Classifier: Programming Language :: Python :: 3.5
  14. Classifier: Programming Language :: Python :: 3.6
  15. Classifier: Programming Language :: Python :: 3.7
  16. Classifier: Programming Language :: Python :: 3.8
  17. Classifier: Programming Language :: Python :: 3.9
  18. Classifier: Programming Language :: Python :: 3.10
  19. Classifier: Programming Language :: Python :: 3.11
  20. Classifier: Programming Language :: Python :: 3.12
  21. Classifier: Programming Language :: Python :: 3 :: Only
  22. Classifier: Framework :: AsyncIO
  23. Requires-Python: >=3.5
  24. Description-Content-Type: text/x-rst
  25. License-File: LICENSE
  26. |Build| |Status| |PyPiVersion| |License| |Downloads|
  27. Introduction
  28. ------------
  29. By design asyncio `does not allow <https://github.com/python/cpython/issues/66435>`_
  30. its event loop to be nested. This presents a practical problem:
  31. When in an environment where the event loop is
  32. already running it's impossible to run tasks and wait
  33. for the result. Trying to do so will give the error
  34. "``RuntimeError: This event loop is already running``".
  35. The issue pops up in various environments, such as web servers,
  36. GUI applications and in Jupyter notebooks.
  37. This module patches asyncio to allow nested use of ``asyncio.run`` and
  38. ``loop.run_until_complete``.
  39. Installation
  40. ------------
  41. .. code-block::
  42. pip3 install nest_asyncio
  43. Python 3.5 or higher is required.
  44. Usage
  45. -----
  46. .. code-block:: python
  47. import nest_asyncio
  48. nest_asyncio.apply()
  49. Optionally the specific loop that needs patching can be given
  50. as argument to ``apply``, otherwise the current event loop is used.
  51. An event loop can be patched whether it is already running
  52. or not. Only event loops from asyncio can be patched;
  53. Loops from other projects, such as uvloop or quamash,
  54. generally can't be patched.
  55. .. |Build| image:: https://github.com/erdewit/nest_asyncio/actions/workflows/test.yml/badge.svg?branche=master
  56. :alt: Build
  57. :target: https://github.com/erdewit/nest_asyncio/actions
  58. .. |PyPiVersion| image:: https://img.shields.io/pypi/v/nest_asyncio.svg
  59. :alt: PyPi
  60. :target: https://pypi.python.org/pypi/nest_asyncio
  61. .. |Status| image:: https://img.shields.io/badge/status-stable-green.svg
  62. :alt:
  63. .. |License| image:: https://img.shields.io/badge/license-BSD-blue.svg
  64. :alt:
  65. .. |Downloads| image:: https://static.pepy.tech/badge/nest-asyncio/month
  66. :alt: Number of downloads
  67. :target: https://pepy.tech/project/nest-asyncio