File: index.rst

package info (click to toggle)
uvloop 0.11.2%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,812 kB
  • sloc: python: 6,096; makefile: 46; ansic: 43
file content (40 lines) | stat: -rw-r--r-- 719 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
User Guide
==========

This section of the documentation provides information about how to use
uvloop.


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

`uvloop` is available from PyPI. It requires Python 3.5.

Use pip to install it.

.. code-block:: console

    $ pip install uvloop


Using uvloop
------------

To make asyncio use the event loop provided by `uvloop`, you install the
`uvloop` event loop policy:

.. code-block:: python

    import asyncio
    import uvloop
    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())


Alternatively, you can create an instance of the loop manually, using:

.. code-block:: python

    import asyncio
    import uvloop
    loop = uvloop.new_event_loop()
    asyncio.set_event_loop(loop)