Skip to main content

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

Project description

AioPlugin

PyPI version PyPI - Downloads License: MIT IDIM

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, however aiocallback does plan to get some of this project's backend stuff in the future so that aiocallback never goes stale but helps keep aioplugin a bit more neat and organized.

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 application's callbacks in some very clean/unique 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.

Other Dependencies

Libraries such as these are the library's main back bones. They were developed for this library specifically with very a tiny footprint, these will not eat diskspace at all if this was your primary concern, these were seperated specifically if developers had something else in mind:

  • freezabledict2 there were so many names taken so many times that a #2 was needed. It works the same way as FrozenList giving the option to mutate a dictionary/hash-table until frozen.

  • reductable-params This library is the main tool responsible for giving developers like you the freedom of positioning parameters however you want or ignore them or create custom parameters using hooks. If you want to make your own stuff, reductable-params is perfect for writing your own callable plugin systems and has powerful performance benefits thanks to it's use of C & Cython, it also has a pure python fallback if you plan to use something a little bit more unsupported like pypy.

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.4.0.tar.gz (11.5 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.4.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aioplugin-0.4.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for aioplugin-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3a65f7641e15fdcaa2cd5c79199bf1d5930a763fd5699c94316fc543f50366e5
MD5 275e640b12434854ddec465039069d38
BLAKE2b-256 c29e91fe71f1e58fb7abb9750921208b53b98a91cd426b5b430cf5f042dae143

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioplugin-0.4.0.tar.gz:

Publisher: release.yaml on Vizonex/aioplugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: aioplugin-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for aioplugin-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b12a7dbc3127e1f8c31bd160a54b9a9787d958c34e8194c169e727a4a66b31b0
MD5 97b8788c0ee47c5f767478d48cebd1d3
BLAKE2b-256 2299066127c299374c6ba6ef51adfdc53432532e11d23ff2ad5b93b6aa97d847

See more details on using hashes here.

Provenance

The following attestation bundles were made for aioplugin-0.4.0-py3-none-any.whl:

Publisher: release.yaml on Vizonex/aioplugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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