lightning-fast, high-performance event handle framework
Project description
Tiny-listener
Tiny-listener is a lightweight event framework with Python 3.6+
Requirements
Python 3.6+
Installation
$ pip install tiny-listener
Feature
Why use tiny-listener:
- Easy to use
- High performance
How does tiny-listener work:
listen(e.g. port, quene, file ...) -> fire(event) -> do(handler)
Usage
example.py
from tiny_listener import Listener, Params
class App(Listener):
async def listen(self, fire):
"""listen event"""
fire("Say hi to Alice") # fire event
fire("Say hi to Bob")
fire("Say hi to Carol")
app = App()
@app.do("Say hi to {name}")
async def say_hi(param: Params):
"""handle event"""
print("Hi,", param["name"])
Run application using tiny-listener command:
$ tiny-listener example:app
>>> Hi, Alice
>>> Hi, Bob
>>> Hi, Carol
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
tiny-listener-0.0.9.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for tiny_listener-0.0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b40482ee36454f74c37bfa95544a49d74ebd78527544f1c3401abbdda706e090 |
|
MD5 | f4cc069051613173b792ee6a2bc07a6a |
|
BLAKE2b-256 | 6e414d4954def0e407ed1d3c359bda7b357604edb8acda5838e3728aa4cde722 |