Skip to main content

An asynchronous plugin tool for writing clean asynchornous decoator and class callback applications.

Project description

AioPlugin

A tool inspired by the way pluggy works with pytest but is meant to help build application-like builds using asynchronous event wrappers. It is the successor to aiocallback as it's primary rewrite. Libraries such as freezabledict2, frozenlist and reductable-params act as a few of the library's primary resources and backbones.

It takes inspiration from the popular discord.py and pluggy libraries allowing you to build very cleaver asynchronous programs. It can be ran in some very unique ways and allows for other developers to add on to your library's callbacks in some very clean and surprising ways.

It can be used with virtually any asynchronous implementations as long as it uses the await syntax. A few examples would include, anyio, trio and asyncio, curio and twisted are not tested but I can gaurentee that it is likely to work with those implementations too.

Small example

from aioplugin.event import event
from aioplugin.plugin import Plugin


class MyEvent(Plugin):
    # you can very easily add your own data, it's recommended 
    # to use typing.Generic for the best results if the data 
    # can be combined to other events.
    def __init__(self, items):
        super().__init__()
        self._items = items

    @event
    async def on_name(self, name: str) -> None:
        pass


events = MyEvent()

print(events.__event_names__)


@events.on_name
async def hello(name: str):
    print(f"Hello {name}")


async def main():
    # Like aiosignal this comes with it's own freezing funciton. 
    # This is inspired by aiocallback as aioplugin was meant 
    # to remedy some of aiocallback's shortcomings and other various bugs.
    events.freeze()
    await events.on_name.send("World!")


if __name__ == "__main__":
    import winloop

    winloop.run(main())

There is much more documentation is coming soon.

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

aioplugin-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

aioplugin-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file aioplugin-0.1.0.tar.gz.

File metadata

  • Download URL: aioplugin-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioplugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cca69571968e2d47ee478e7c622788f54bd13beba8212645c07ee56f56b8c59
MD5 c1ace59cacbb78ed87a7aefb3f225a43
BLAKE2b-256 ff4a907dbf2495322801beace769411c6100e13a7ca14ea6c8d7dccfd1d9d013

See more details on using hashes here.

File details

Details for the file aioplugin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aioplugin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aioplugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55b20e784f5ff15d01d85518a777a2693e1e7500ce155b7f6adebb014b6d2df8
MD5 f2718092875a460c47c7b34c2832cbad
BLAKE2b-256 1183329113fea4a0c444bba95260fd868ac68d95252a96c81bcc83900e242559

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