您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

176 行
4.8 KiB

  1. Metadata-Version: 2.1
  2. Name: uvloop
  3. Version: 0.21.0
  4. Summary: Fast implementation of asyncio event loop on top of libuv
  5. Author-email: Yury Selivanov <yury@magic.io>
  6. License: MIT License
  7. Project-URL: github, https://github.com/MagicStack/uvloop
  8. Keywords: asyncio,networking
  9. Classifier: Development Status :: 5 - Production/Stable
  10. Classifier: Framework :: AsyncIO
  11. Classifier: Intended Audience :: Developers
  12. Classifier: License :: OSI Approved :: Apache Software License
  13. Classifier: License :: OSI Approved :: MIT License
  14. Classifier: Operating System :: POSIX
  15. Classifier: Operating System :: MacOS :: MacOS X
  16. Classifier: Programming Language :: Python :: 3 :: Only
  17. Classifier: Programming Language :: Python :: 3.8
  18. Classifier: Programming Language :: Python :: 3.9
  19. Classifier: Programming Language :: Python :: 3.10
  20. Classifier: Programming Language :: Python :: 3.11
  21. Classifier: Programming Language :: Python :: 3.12
  22. Classifier: Programming Language :: Python :: 3.13
  23. Classifier: Programming Language :: Python :: Implementation :: CPython
  24. Classifier: Topic :: System :: Networking
  25. Requires-Python: >=3.8.0
  26. Description-Content-Type: text/x-rst
  27. License-File: LICENSE-APACHE
  28. License-File: LICENSE-MIT
  29. Provides-Extra: dev
  30. Requires-Dist: setuptools>=60; extra == "dev"
  31. Requires-Dist: Cython~=3.0; extra == "dev"
  32. Provides-Extra: docs
  33. Requires-Dist: Sphinx~=4.1.2; extra == "docs"
  34. Requires-Dist: sphinxcontrib-asyncio~=0.3.0; extra == "docs"
  35. Requires-Dist: sphinx-rtd-theme~=0.5.2; extra == "docs"
  36. Provides-Extra: test
  37. Requires-Dist: aiohttp>=3.10.5; extra == "test"
  38. Requires-Dist: flake8~=5.0; extra == "test"
  39. Requires-Dist: psutil; extra == "test"
  40. Requires-Dist: pycodestyle~=2.9.0; extra == "test"
  41. Requires-Dist: pyOpenSSL~=23.0.0; extra == "test"
  42. Requires-Dist: mypy>=0.800; extra == "test"
  43. .. image:: https://img.shields.io/github/actions/workflow/status/MagicStack/uvloop/tests.yml?branch=master
  44. :target: https://github.com/MagicStack/uvloop/actions/workflows/tests.yml?query=branch%3Amaster
  45. .. image:: https://img.shields.io/pypi/v/uvloop.svg
  46. :target: https://pypi.python.org/pypi/uvloop
  47. .. image:: https://pepy.tech/badge/uvloop
  48. :target: https://pepy.tech/project/uvloop
  49. :alt: PyPI - Downloads
  50. uvloop is a fast, drop-in replacement of the built-in asyncio
  51. event loop. uvloop is implemented in Cython and uses libuv
  52. under the hood.
  53. The project documentation can be found
  54. `here <http://uvloop.readthedocs.org/>`_. Please also check out the
  55. `wiki <https://github.com/MagicStack/uvloop/wiki>`_.
  56. Performance
  57. -----------
  58. uvloop makes asyncio 2-4x faster.
  59. .. image:: https://raw.githubusercontent.com/MagicStack/uvloop/master/performance.png
  60. :target: http://magic.io/blog/uvloop-blazing-fast-python-networking/
  61. The above chart shows the performance of an echo server with different
  62. message sizes. The *sockets* benchmark uses ``loop.sock_recv()`` and
  63. ``loop.sock_sendall()`` methods; the *streams* benchmark uses asyncio
  64. high-level streams, created by the ``asyncio.start_server()`` function;
  65. and the *protocol* benchmark uses ``loop.create_server()`` with a simple
  66. echo protocol. Read more about uvloop in a
  67. `blog post <http://magic.io/blog/uvloop-blazing-fast-python-networking/>`_
  68. about it.
  69. Installation
  70. ------------
  71. uvloop requires Python 3.8 or greater and is available on PyPI.
  72. Use pip to install it::
  73. $ pip install uvloop
  74. Note that it is highly recommended to **upgrade pip before** installing
  75. uvloop with::
  76. $ pip install -U pip
  77. Using uvloop
  78. ------------
  79. As of uvloop 0.18, the preferred way of using it is via the
  80. ``uvloop.run()`` helper function:
  81. .. code:: python
  82. import uvloop
  83. async def main():
  84. # Main entry-point.
  85. ...
  86. uvloop.run(main())
  87. ``uvloop.run()`` works by simply configuring ``asyncio.run()``
  88. to use uvloop, passing all of the arguments to it, such as ``debug``,
  89. e.g. ``uvloop.run(main(), debug=True)``.
  90. With Python 3.11 and earlier the following alternative
  91. snippet can be used:
  92. .. code:: python
  93. import asyncio
  94. import sys
  95. import uvloop
  96. async def main():
  97. # Main entry-point.
  98. ...
  99. if sys.version_info >= (3, 11):
  100. with asyncio.Runner(loop_factory=uvloop.new_event_loop) as runner:
  101. runner.run(main())
  102. else:
  103. uvloop.install()
  104. asyncio.run(main())
  105. Building From Source
  106. --------------------
  107. To build uvloop, you'll need Python 3.8 or greater:
  108. 1. Clone the repository:
  109. .. code::
  110. $ git clone --recursive git@github.com:MagicStack/uvloop.git
  111. $ cd uvloop
  112. 2. Create a virtual environment and activate it:
  113. .. code::
  114. $ python3 -m venv uvloop-dev
  115. $ source uvloop-dev/bin/activate
  116. 3. Install development dependencies:
  117. .. code::
  118. $ pip install -e .[dev]
  119. 4. Build and run tests:
  120. .. code::
  121. $ make
  122. $ make test
  123. License
  124. -------
  125. uvloop is dual-licensed under MIT and Apache 2.0 licenses.