async-chain (0.1.4)

Published 2025-11-25 05:47:21 +01:00 by Steffo in steffo/async-chain

Installation

pip install --index-url  async-chain

About this package

Utility for chaining awaits

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

Requirements

Requires Python: >=3.10,<4.0
Details
PyPI
2025-11-25 05:47:21 +01:00
4
Stefano Pigozzi
7.6 KiB
Assets (2)
Versions (3) View all
0.1.5 2025-11-25
0.1.4 2025-11-25
0.1.0 2025-11-25