Utility for chaining awaits
This repository has been archived on 2026-09-09. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2025-11-25 06:09:16 +01:00
.forgejo/workflows Add Forgejo Actions workflows 2025-11-25 05:45:43 +01:00
.idea First commit (0.1.0) 2021-06-13 20:42:02 +02:00
.media Update icons 2025-11-25 05:13:47 +01:00
async_chain Move integration tests outside of the package 2025-11-25 05:14:19 +01:00
tests Move integration tests outside of the package 2025-11-25 05:14:19 +01:00
.editorconfig Add .editorconfig 2025-11-25 05:12:53 +01:00
.gitignore First commit (0.1.0) 2021-06-13 20:42:02 +02:00
async-chain.iml First commit (0.1.0) 2021-06-13 20:42:02 +02:00
LICENSE.txt Relicense to MIT 2025-11-25 05:34:18 +01:00
poetry.lock Port pyproject.toml to the new format 2025-11-25 05:41:46 +01:00
pyproject.toml Bump version to 0.1.5 2025-11-25 06:09:16 +01:00
README.md Rewrite README 2025-11-25 05:45:37 +01:00

Async Chain

Utility for chaining awaits

About

This package allows library developers to write interfaces that are both fluent and async, avoiding ugly syntax, like in the following example:

async def on_message(event):
    # bad!
    (await (await (await event.get_message()).get_author()).send_message("Hello world!"))

Instead, by marking all involved methods with the @async_chain.method decorator:

import async_chain

class MyEvent:
    @async_chain.method
    async def get_message(self):
        ...

The following syntax can be achieved:

async def on_message(event):
    # nice!
    await event.get_message().get_author().send_message("Hello world!")

Tools

Written in Python

Packaging

Available on PyPI   Available on Forgejo Packages

Documentation

Licensed under MIT license

Development

Code repository   Releases   Issues   Pull requests