Skip to main content

Asyevent

An implementation of events and asynchronous callbacks using decorators.

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

An implementation of events and asynchronous callbacks using decorators. The project is currently in development. The main features are stables and work perfectly as I've tested, but if you notice any issue, or you have a suggestion to make, it's greatly appreciated.

Built using

GETTING STARTED

Installation

pip install asyevent

Usage

import asyncio
from asyevent import EventManager


# creates a main event manager
manager = EventManager()

# creates an event
sample_event = manager.create_event("sample_event")


# adds `call_on_event` coroutine as sample_event's callback
@sample_event.as_callback()
async def sample_event_callback(text: str):
    print(text)
    await asyncio.sleep(2)


# uses `.after` event which refers to an event that is raised
# when the parent event's callbacks are ended (data_lost)
@sample_event.after(pass_extra=True).as_callback()
async def after_event(time_took: int, *args):
    # invokes the command `say`
    await manager.invoke_command("say", f"I've been here for {time_took} seconds")


# adds the `say_stm` coroutine as a callback of the command `say`
@manager.as_command(name="say")
async def say_stm(name: str):
    print(f"Hello, {name} !")


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    # raises the event `sample_event`
    loop.run_until_complete(sample_event("Hello, world !"))

More example in asyevent/examples/ folder.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Zucchinetti Hervé

GitHub

Readme template

Metadata

Release files for asyevent 0.2.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asyevent 0.2.10
File Size Uploaded
asyevent-0.2.10.tar.gz 15.1 kB Details

Release files / asyevent-0.2.10.tar.gz

Download URL asyevent-0.2.10.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5699e394e33b6af2c8ca963b3cebe6e1fb49db3624c51b527c7280060a3ad651
BLAKE2b-256 checksum
How to use checksums
14fd223b46424b31c006b7a8cf16abc39a276d5bf8b6348ab83d80663e2470c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.2.10 This release

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.1

1 release file

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page