Skip to main content

Utility for chaining awaits

Project description

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!")

Links

Tools

Written in Python

Packaging

Available on PyPI Available on Forgejo Packages

Documentation

Licensed under MIT license

Development

Code repository Releases Issues Pull requests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

async_chain-0.1.4.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

async_chain-0.1.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file async_chain-0.1.4.tar.gz.

File metadata

  • Download URL: async_chain-0.1.4.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for async_chain-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f281892a2da447fdf7e6cb4dd59d7597cae74b844f52295454847923e83ca5ff
MD5 b063ad0cd929ad5c92b8d66a1ee6c6b6
BLAKE2b-256 8bbefd111485919f49e3b7b622afe77e767b84486611197b26a2d6b7e1b25fb2

See more details on using hashes here.

File details

Details for the file async_chain-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: async_chain-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for async_chain-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 eb13bda4f2e71c9ac715dc54caf0c2556f50e1c0d0d74cf5292a44cfae86eada
MD5 b605ee4455cd0589f4fc3a8e8f602ba9
BLAKE2b-256 8c23224ab05ddfa8956c504ef524a7edf0a138a6354ebffd9144e77cb06ed045

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page