A high-performance, simple-structured event system, relies on asyncio
Project description
Letoderea
一个高性能,结构简洁,依赖于 Python内置库asyncio
的事件系统, 设计灵感来自Graia BroadcastControl
。
项目仍处于开发阶段,部分内容可能会有较大改变
安装
从 PyPI 安装
pip install arclet-letoderea
样例
from arclet.letoderea import EventSystem, Contexts
es = EventSystem()
class TestEvent:
async def gather(self, context: Contexts):
context["name"] = "Letoderea"
@es.on(TestEvent)
async def test_subscriber(name: str):
print(name)
es.loop.run_until_complete(es.publish(TestEvent()))
特性
- 任何实现了
gather
方法的类都可以作为事件 - 通过
Provider
实现依赖注入的静态绑定,提高性能 - 通过
Contexts
增强事件传递的灵活性 - 通过
Publisher
实现事件响应的隔离 - 通过
Auxiliary
提供了一系列辅助方法,方便事件的处理
开源协议
本实现以 MIT 为开源协议。
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.
Source Distribution
arclet-letoderea-0.5.0.tar.gz
(16.5 kB
view hashes)
Built Distribution
Close
Hashes for arclet_letoderea-0.5.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88b077e4eb8c47fbb9d531e118359fe3966cd6b4083468f1130f924e30fd3667 |
|
MD5 | 317e8fd8b8098503a39b6718689d2d17 |
|
BLAKE2b-256 | a42c7099df6ed4b9475f2f86fefd02a5fb4e8e9953d3094931a309214c1493bf |