Top Banner
2014/7/7 okonomi kuroko (1) file:///Users/hattori-h/hex.html#(1) 1/15 okonomi kuroko osakapy 2014.03.13 LT / 2014.03.13 Hideo Hattori
15

Osakapy 20140313 lt

Jul 10, 2015

Download

Technology

Hattori Hideo
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 1/15

okonomi kuroko

osakapy 2014.03.13 LT / 2014.03.13 Hideo Hattori

Page 2: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 2/15

whoami@hhatto

C/Python/Zsh/Go

My Python Projects autopep8, pgmagick, otamapy, genzshcomp, meow ...

code on Github, Bitbucket

Page 3: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 3/15

Contentskurokoとは

なんで作ったの?

TODO

Page 4: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 4/15

kuroko

Page 5: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 5/15

About kuroko定期的にタスクを実行してくれるモジュール

v0.1.1 (2014.03.11)

for Python2.x and Python3.x

PyPIからインストールできます

$ pip install --upgrade kuroko

Page 6: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 6/15

MotivationCinchの代役

デコレータを使ってみたかった

Page 7: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 7/15

For Example

Page 8: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 8/15

5秒間隔で"hoge"と表示するimport kuroko

class MyBot(kuroko.Bot):

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

bot = MyBot()bot.start()

Page 9: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 9/15

crontabライクな記法で実行間隔を指定内部で crontabモジュールを使用

>>> from crontab import CronTab>>> c = CronTab('*/5 * * * *')>>> c.next()21.400852

Page 10: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 10/15

crontabライクな記法で実行間隔を指定from kuroko import Bot, crontab

class MyBot(Bot):

@crontab('* 1 * * *') def echo_pong(self): print("hoge")

bot = MyBot()bot.start()

Page 11: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 11/15

Other Featuresファイル監視イベントの通知 (watchdog)

ロギング (Logbook)

Page 12: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 12/15

TODOログの強化

ログのカラー化

コールバック関数を何回呼んだか等の統計情報表時(cli, web-frontend)

ターミナルらいくなコマンド実行インターフェース

Page 13: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 13/15

ぜひkurokoを使ってみてください!!

Page 14: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 14/15

https://github.com/hhatto/kuroko

Page 15: Osakapy 20140313 lt

2014/7/7 okonomi kuroko (1)

file:///Users/hattori-h/hex.html#(1) 15/15

Thank you