An implementation of events and asynchronous callbacks using decorators.
Project description
Asyevent
An implementation of events and asynchronous callbacks using decorators.
Report Bug
·
Request Feature
Table of Contents
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
manager = EventManager()
sample_event = manager.create_event('sample_event')
@sample_event.as_callback()
async def call_on_event(text: str):
print(text)
await asyncio.sleep(2)
@sample_event.after.as_callback()
async def after_event(time_took: int, *args):
await manager.invoke_command('say_hello', f'I\'ve been here for {time_took} seconds')
@manager.as_command('say_hello')
async def hello(name: str):
print(f'Hello, {name} !')
if __name__ == '__main__':
loop = asyncio.get_event_loop()
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.