Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lotify: a python SDK for LINE Notify

Lotify: a python SDK for LINE Notify

COSCUP 2020 day2 (0802) main track session: https://coscup.org/2020/zh-TW/agenda/KNJDWQ

LINE Developers Taiwan

August 02, 2020
Tweet

More Decks by LINE Developers Taiwan

Other Decks in Technology

Transcript

  1. LINE No'fy h"ps://no)fy-bot.line.me/zh_TW/ • Provided by LINE. • One way

    notify. • LINE official account. • LINE push message to user. • Via OAuth 2.0.
  2. LINE Notify https://notify-bot.line.me/zh_TW/ • Provided by LINE. • One way

    notify. • LINE official account. • LINE push message to user. • Via OAuth 2.0.
  3. • Needed a SDK which can let me use it

    quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python Why I need to create Lotify
  4. • Needed a SDK which can let me use it

    quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python. Why I need to create Lo/fy
  5. Find most star LINE Notify SDK at Pypi & Github

    https://github.com/louis70109/lotify
  6. • It had many good code. • It could be

    better: • Unit test. • Functionalize send message type. • No authorization flow: • Link url • Change token • Get status Why I need to create Lotify
  7. • Needed a SDK which can let me use it

    quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test from line-bot-sdk-python. Why I need to create Lotify
  8. • Needed a SDK which can let me use it

    quickly • Many Pypi packages just do half features • If I used LINE No@fy I need to call normal API again • Learned good unit test from line-bot-sdk-python Why I need to create Lotify
  9. Why do I need to create Lotify? • Needed a

    SDK which can let me use it quickly • Many Pypi packages just do half features • If I used LINE No@fy I need to call normal API again • Learned good unit test from line-bot-sdk-python
  10. • Needed a SDK which can let me use it

    quickly. • Many Pypi packages just do half features. • If I used LINE Notify I need to call normal API again. • Learned good unit test by line-bot-sdk-python. Why I need to create Lotify
  11. • I referenced line-bot-sdk-python unit test. • Authoriza8on flow. •

    Documenta8on. • It had example : • h?ps://github.com/louis70109/flask-line-no8fy • One click deployment deploy to Heroku. Why I need to create Lotify
  12. h"ps://github.com/miyakogi/m2r • Read Markdown file from absolute path and transform

    Markdown to reStructuredText in generate static file flow by m2r package. Package only can reStructuredText
  13. • Read Markdown file from absolute path and transform Markdown

    to reStructuredText in generate static file flow by m2r package Version control
  14. • Used a single file to control package version, it

    could be be5er to control. • Input bo5om code in setup.py: Version control
  15. • Input variable in setup() version column. • When you

    upload new version it would read __version__.py automa:cally. • Every modifica:on need to add version number. Version control
  16. • It can let contributor use requirements.txt correctly. • If

    your SDK had different environment pipline, this method would not pollute them. Split requirements environment
  17. • It need .travis.yml file to run. • The file

    can trigger Travis CI. • Nice to have auto test. • Choose your favorite CI platform. Travis
  18. • It need .travis.yml file to run • The file

    can trigger Travis CI • It’s nice to have auto test • Choose your favorite CI pla:orm Travis
  19. • It need .travis.yml file to run • The file

    can trigger Travis CI • It’s nice to have auto test • Choose your favorite CI pla:orm Travis - Badge GitHub Action could catch Travis result once
  20. • It need tox.ini file to run. • Check mul3

    python version. • Lo3fy was checked 3.5~3.8 • Run Linter(flake8). • CI is suitable. Tox
  21. • “self” share between Class and Instance level. • Bot_orgin

    & api_origin can change url, if developer want to Stress testing. Variable level
  22. • LINE Notify & Lotify flow. • Why I implement

    Lotify. • What are Lotify have. • Version control. • Pypi upload config. • Requirement file. • Travis & Tox • Namespace & variable level. • Heroku – one click deployment. Arrangement