Metadata-Version: 2.4
Name: async-chain
Version: 0.1.5
Summary: Utility for chaining awaits
License-Expression: MIT
License-File: LICENSE.txt
Keywords: asyncio,chain
Author: Stefano Pigozzi
Author-email: me@steffo.eu
Maintainer: Stefano Pigozzi
Maintainer-email: me@steffo.eu
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Framework :: AsyncIO
Classifier: Typing :: Typed
Project-URL: Issues, https://forge.steffo.eu/steffo/async-chain/issues
Project-URL: Source, https://forge.steffo.eu/steffo/async-chain
Description-Content-Type: text/markdown

<div align="center">
<img alt="" src="https://forge.steffo.eu/steffo/async-chain/raw/branch/main/.media/icon-512.png" height="128" style="border-radius: 100%;">
<hgroup>
<h1>Async Chain</h1>
<p>Utility for chaining awaits</p>
</hgroup>
</div>

## About

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

```python
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:

```python
import async_chain

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

The following syntax can be achieved:

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

## Links

### Tools

<a href="https://www.python.org/">
    <img alt="Written in Python" title="Written in Python" src="https://img.shields.io/badge/language-python-3775a9" height="30px">
</a>

### Packaging

<a href="https://pypi.org/project/async-chain">
    <img alt="Available on PyPI" title="Available on PyPI" src="https://img.shields.io/pypi/v/async-chain?label=pypi&color=ffd242" height="30px">
</a>
&hairsp;
<a href="https://forge.steffo.eu/steffo/-/packages/pypi/async-chain">
    <img alt="Available on Forgejo Packages" title="Available on Forgejo Packages" src="https://img.shields.io/badge/forgejo%20packages-latest-ff6600" height="30px">
</a>

### Documentation

<a href="https://opensource.org/license/MIT">
    <img alt="Licensed under MIT license" title="Licensed under MIT license" src="https://img.shields.io/badge/license-MIT-3da638" height="30px">
</a>

### Development

<a href="https://forge.steffo.eu/steffo/async-chain">
    <img alt="Code repository" title="Code repository" src="https://img.shields.io/gitea/last-commit/steffo/async-chain?gitea_url=https%3A%2F%2Fforge.steffo.eu&color=374351" height="30px">
</a>
&hairsp;
<a href="https://forge.steffo.eu/steffo/async-chain/releases">
    <img alt="Releases" title="Releases" src="https://img.shields.io/gitea/v/release/steffo/async-chain?gitea_url=https%3A%2F%2Fforge.steffo.eu&label=last+release&color=374351" height="30px">
</a>
&hairsp;
<a href="https://forge.steffo.eu/steffo/async-chain/issues">
    <img alt="Issues" title="Issues" src="https://img.shields.io/gitea/issues/open/steffo/async-chain?gitea_url=https%3A%2F%2Fforge.steffo.eu&label=issues&color=374351" height="30px">
</a>
&hairsp;
<a href="https://forge.steffo.eu/steffo/async-chain/pulls">
    <img alt="Pull requests" title="Pull requests" src="https://img.shields.io/gitea/pull-requests/open/steffo/async-chain?gitea_url=https%3A%2F%2Fforge.steffo.eu&color=374351" height="30px">
</a>

