Guido van Rossum | 7a46564 | 2013-11-22 11:47:22 -0800 | [diff] [blame] | 1 | :mod:`asyncio` -- Asynchronous I/O, event loop, coroutines and tasks |
| 2 | ==================================================================== |
| 3 | |
| 4 | .. module:: asyncio |
| 5 | :synopsis: Asynchronous I/O, event loop, coroutines and tasks. |
| 6 | |
Nick Coghlan | af117ed | 2014-09-06 19:43:06 +1000 | [diff] [blame] | 7 | .. note:: |
| 8 | |
| 9 | The asyncio package has been included in the standard library on a |
| 10 | :term:`provisional basis <provisional package>`. Backwards incompatible |
| 11 | changes (up to and including removal of the module) may occur if deemed |
| 12 | necessary by the core developers. |
| 13 | |
Guido van Rossum | 7a46564 | 2013-11-22 11:47:22 -0800 | [diff] [blame] | 14 | .. versionadded:: 3.4 |
| 15 | |
Guido van Rossum | f8d0ff9 | 2013-11-22 16:53:25 -0800 | [diff] [blame] | 16 | **Source code:** :source:`Lib/asyncio/` |
| 17 | |
| 18 | -------------- |
Guido van Rossum | 7a46564 | 2013-11-22 11:47:22 -0800 | [diff] [blame] | 19 | |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 20 | This module provides infrastructure for writing single-threaded concurrent |
| 21 | code using coroutines, multiplexing I/O access over sockets and other |
| 22 | resources, running network clients and servers, and other related primitives. |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 23 | Here is a more detailed list of the package contents: |
| 24 | |
Victor Stinner | 9592edb | 2014-02-02 15:03:02 +0100 | [diff] [blame] | 25 | * a pluggable :ref:`event loop <asyncio-event-loop>` with various system-specific |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 26 | implementations; |
| 27 | |
Victor Stinner | 9592edb | 2014-02-02 15:03:02 +0100 | [diff] [blame] | 28 | * :ref:`transport <asyncio-transport>` and :ref:`protocol <asyncio-protocol>` abstractions |
Georg Brandl | b7354a6 | 2014-10-29 10:57:37 +0100 | [diff] [blame] | 29 | (similar to those in `Twisted <https://twistedmatrix.com/trac/>`_); |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 30 | |
| 31 | * concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and |
| 32 | others (some may be system-dependent); |
| 33 | |
Brian Curtin | a1afeec | 2014-02-08 18:36:14 -0600 | [diff] [blame] | 34 | * a :class:`Future` class that mimics the one in the :mod:`concurrent.futures` |
Victor Stinner | 99c2ab4 | 2013-12-03 19:17:25 +0100 | [diff] [blame] | 35 | module, but adapted for use with the event loop; |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 36 | |
| 37 | * coroutines and tasks based on ``yield from`` (:PEP:`380`), to help write |
| 38 | concurrent code in a sequential fashion; |
| 39 | |
Eli Bendersky | b73c833 | 2014-02-09 06:07:47 -0800 | [diff] [blame] | 40 | * cancellation support for :class:`Future`\s and coroutines; |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 41 | |
Victor Stinner | 9592edb | 2014-02-02 15:03:02 +0100 | [diff] [blame] | 42 | * :ref:`synchronization primitives <asyncio-sync>` for use between coroutines in |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 43 | a single thread, mimicking those in the :mod:`threading` module; |
| 44 | |
Guido van Rossum | f0f5d38 | 2013-11-22 15:45:02 -0800 | [diff] [blame] | 45 | * an interface for passing work off to a threadpool, for times when |
| 46 | you absolutely, positively have to use a library that makes blocking |
| 47 | I/O calls. |
| 48 | |
Terry Jan Reedy | 9ff4180 | 2014-07-24 02:59:02 -0400 | [diff] [blame] | 49 | Table of contents: |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 50 | |
Victor Stinner | ea3183f | 2013-12-03 01:08:00 +0100 | [diff] [blame] | 51 | .. toctree:: |
| 52 | :maxdepth: 3 |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 53 | |
Victor Stinner | ea3183f | 2013-12-03 01:08:00 +0100 | [diff] [blame] | 54 | asyncio-eventloop.rst |
Victor Stinner | aea8229 | 2014-07-08 23:42:38 +0200 | [diff] [blame] | 55 | asyncio-eventloops.rst |
Victor Stinner | ea3183f | 2013-12-03 01:08:00 +0100 | [diff] [blame] | 56 | asyncio-task.rst |
| 57 | asyncio-protocol.rst |
Victor Stinner | 24f8ebf | 2014-01-23 11:05:01 +0100 | [diff] [blame] | 58 | asyncio-stream.rst |
Victor Stinner | 0844438 | 2014-02-02 22:43:39 +0100 | [diff] [blame] | 59 | asyncio-subprocess.rst |
Victor Stinner | ea3183f | 2013-12-03 01:08:00 +0100 | [diff] [blame] | 60 | asyncio-sync.rst |
Victor Stinner | db39a0d | 2014-01-16 18:58:01 +0100 | [diff] [blame] | 61 | asyncio-dev.rst |
Antoine Pitrou | bba8682 | 2013-11-23 00:34:26 +0100 | [diff] [blame] | 62 | |
Victor Stinner | 85a2be7 | 2013-12-03 15:04:36 +0100 | [diff] [blame] | 63 | .. seealso:: |
| 64 | |
Terry Jan Reedy | 9ff4180 | 2014-07-24 02:59:02 -0400 | [diff] [blame] | 65 | The :mod:`asyncio` module was designed in :PEP:`3156`. For a |
Victor Stinner | 85a2be7 | 2013-12-03 15:04:36 +0100 | [diff] [blame] | 66 | motivational primer on transports and protocols, see :PEP:`3153`. |
| 67 | |