Skip to content

Docs: Add asyncio source code links #16640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
Event Loop
==========

**Source code:** :source:`Lib/asyncio/events.py`,
:source:`Lib/asyncio/base_events.py`

------------------------------------

.. rubric:: Preface

Expand Down
3 changes: 3 additions & 0 deletions Doc/library/asyncio-exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
Exceptions
==========

**Source code:** :source:`Lib/asyncio/exceptions.py`

----------------------------------------------------

.. exception:: TimeoutError

Expand Down
5 changes: 5 additions & 0 deletions Doc/library/asyncio-future.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
Futures
=======

**Source code:** :source:`Lib/asyncio/futures.py`,
:source:`Lib/asyncio/base_futures.py`

-------------------------------------

*Future* objects are used to bridge **low-level callback-based code**
with high-level async/await code.

Expand Down
6 changes: 6 additions & 0 deletions Doc/library/asyncio-platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ All Platforms
Windows
=======

**Source code:** :source:`Lib/asyncio/proactor_events.py`,
:source:`Lib/asyncio/windows_events.py`,
:source:`Lib/asyncio/windows_utils.py`

--------------------------------------

.. versionchanged:: 3.8

On Windows, :class:`ProactorEventLoop` is now the default event loop.
Expand Down
8 changes: 8 additions & 0 deletions Doc/library/asyncio-protocol.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ This documentation page contains the following sections:
Transports
==========

**Source code:** :source:`Lib/asyncio/transports.py`

----------------------------------------------------

Transports are classes provided by :mod:`asyncio` in order to abstract
various kinds of communication channels.

Expand Down Expand Up @@ -431,6 +435,10 @@ Subprocess Transports
Protocols
=========

**Source code:** :source:`Lib/asyncio/protocols.py`

---------------------------------------------------

asyncio provides a set of abstract base classes that should be used
to implement network protocols. Those classes are meant to be used
together with :ref:`transports <asyncio-transport>`.
Expand Down
4 changes: 4 additions & 0 deletions Doc/library/asyncio-queue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Queues
======

**Source code:** :source:`Lib/asyncio/queues.py`

------------------------------------------------

asyncio queues are designed to be similar to classes of the
:mod:`queue` module. Although asyncio queues are not thread-safe,
they are designed to be used specifically in async/await code.
Expand Down
4 changes: 4 additions & 0 deletions Doc/library/asyncio-stream.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Streams
=======

**Source code:** :source:`Lib/asyncio/streams.py`

-------------------------------------------------

Streams are high-level async/await-ready primitives to work with
network connections. Streams allow sending and receiving data without
using callbacks or low-level protocols and transports.
Expand Down
5 changes: 5 additions & 0 deletions Doc/library/asyncio-subprocess.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
Subprocesses
============

**Source code:** :source:`Lib/asyncio/subprocess.py`,
:source:`Lib/asyncio/base_subprocess.py`

----------------------------------------

This section describes high-level async/await asyncio APIs to
create and manage subprocesses.

Expand Down
4 changes: 4 additions & 0 deletions Doc/library/asyncio-sync.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
Synchronization Primitives
==========================

**Source code:** :source:`Lib/asyncio/locks.py`

-----------------------------------------------

asyncio synchronization primitives are designed to be similar to
those of the :mod:`threading` module with two important caveats:

Expand Down
10 changes: 7 additions & 3 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ and Tasks.
Coroutines
==========

Coroutines declared with async/await syntax is the preferred way of
writing asyncio applications. For example, the following snippet
of code (requires Python 3.7+) prints "hello", waits 1 second,
:term:`Coroutines <coroutine>` declared with the async/await syntax is the
preferred way of writing asyncio applications. For example, the following
snippet of code (requires Python 3.7+) prints "hello", waits 1 second,
Comment on lines +21 to +23
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to adjust the word wrapping here after adding the Sphinx role and grammar fix.

and then prints "world"::

>>> import asyncio
Expand Down Expand Up @@ -240,6 +240,10 @@ Running an asyncio Program
.. versionchanged:: 3.9
Updated to use :meth:`loop.shutdown_default_executor`.

.. note::
The source code for ``asyncio.run()`` can be found in
:source:`Lib/asyncio/runners.py`.

Creating Tasks
==============

Expand Down
5 changes: 4 additions & 1 deletion Doc/library/asyncio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.. module:: asyncio
:synopsis: Asynchronous I/O.

--------------
-------------------------------

.. sidebar:: Hello World!

Expand Down Expand Up @@ -91,3 +91,6 @@ Additionally, there are **low-level** APIs for
asyncio-api-index.rst
asyncio-llapi-index.rst
asyncio-dev.rst

.. note::
The source code for asyncio can be found in :source:`Lib/asyncio/`.