Skip to main content

lightning-fast, high-performance event handle framework

Project description

Tiny-listener

Tiny-listener is a lightweight event framework with Python 3.6+

中文 / English

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


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)

Uploaded Source

Built Distribution

tiny_listener-0.0.9-py3-none-any.whl (19.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page