kuroko

Minimalistic Python Bot Framework


Keywords
bot, framework
License
MIT
Install
pip install kuroko==0.1.7

Documentation

Kuroko

https://travis-ci.org/hhatto/kuroko.svg?branch=master

Minimalistic Python Task Executor Framework

Requirements

Installation

pip install kuroko

Usage

examples

5sec interval task execution

import kuroko

class MyBot(kuroko.Bot):

    @kuroko.timer(5)
    def echo_pong(self):
        print("pong")

bot = MyBot()
bot.start()

crontab like task execution

class MyBot(kuroko.Bot):

    @kuroko.crontab('*/5 * * * *')
    def echo_pong(self):
        print("pong")

watchdog thin wrapper

class MyBot(kuroko.Bot):

    @kuroko.watch
    def echo_pong(self, event):
        print("pong", event)

    @kuroko.watch(patterns=['*.py'])
    def echo_ping(self, event):
        print("ping", event)

logging

class MyBot(kuroko.Bot):

    @kuroko.crontab('*/5 * * * *')
    def echo_pong(self):
        self.log.info("app logging")

Restart & Stop task

send a SIGUSR1 when you want to restart the all tasks, send a SIGHUP when you want to stop the all tasks.

TODO

  • [ ] support multi-thread model
  • [ ] colorize logging
  • [ ] statistics web frontend
  • [ ] terminal like interface

License

MIT