Skip to main content

Awaitable Tools

This package provides utilities for working with awaitable objects in Python.

Coroutines vs Awaitables

Coroutines

Objects returned from the function declared with the async def syntax. It is the standard way to create asynchronous programs.

async def coroutine():
    pass

Awaitable

Any object that implements __await__() for use in an await expression.

class Awaitable:
    def __await__(self):
        yield

Installation

pip install awaitable-tools

While most users work with coroutines, some advanced scenarios (like protocol implementations or framework development) require working directly with awaitables. This package fills that gap.

Technical Background

The Awaitable Protocol

An object is awaitable if its __await__() method returns an generator that:

  1. Only yields None (any other value raises RuntimeError)
  2. Final value uses return (not yield)
  3. May use yield from with other compliant generators
class ValidAwaitable:
    def __await__(self):
        yield None  # Valid suspension
        # coroutine also implements __await__()
        yield from asyncio.sleep(1).__await__()
        return True

class InvalidAwaitable:
    def __await__(self):
        # Only valid if marked as @types.coroutine
        yield from asyncio.sleep(1)  # TypeError!
        yield "foo"  # RuntimeError!

About async/await

April 18, 2020, From yield to async/await

Release files for awaitable-tools 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for awaitable-tools 0.0.1
File Size Uploaded
awaitable_tools-0.0.1.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for awaitable-tools 0.0.1
File Interpreter ABI Platform
awaitable_tools-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / awaitable_tools-0.0.1.tar.gz

Download URL awaitable_tools-0.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8a2f5d4031b11741bd9acaba8f6bdc2b4b420abe70ecab6c22901faa70d19c44
BLAKE2b-256 checksum
How to use checksums
337e7f72f4498636ff672022850d4ae9ef9b3ecf319c96f174e7c7751a76ea2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 27, 2025.

Transparency log

Release files / awaitable_tools-0.0.1-py3-none-any.whl

Download URL awaitable_tools-0.0.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9382020fdbc680b74cde8aafb1edfc2b172b46c874d9dd7afc1450582028802c
BLAKE2b-256 checksum
How to use checksums
5e441922ba8045a17ab05a9bde4e02d78c4e8ea8eb09be28cceef05b6a091b21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 27, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page