Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

오픈소스 라이브러리 개발기

894 views

Published on

사진과 글자, 링크가 잘 보이지 않을경우 전체화면 혹은 다운로드 후 PDF뷰어(추천)로 보시면 깨끗한 화질로 보실 수 있습니다.

Postmortem of an opensource library chatterbox.py

Published in: Technology

오픈소스 라이브러리 개발기

  1. 1. chatterbox.py winterj.me@gmail.com JungWinterres_tin
  2. 2. 0. 1. 2. 3.
  3. 3. 0.
  4. 4. JungWinter/HongikFood
  5. 5. ,
  6. 6. API
  7. 7. session, intent, context POST /message API callback content
  8. 8. 1.
  9. 9. 2.
  10. 10. PEP8 if-else
  11. 11. JungWinter/yellowid-flask
  12. 12. 1.
  13. 13. JSON response if-elif-else
  14. 14. 1.
  15. 15. 2.
  16. 16. 3. response
  17. 17. 3. response 3
  18. 18. Pythonic , Depth JSON response if-elif-else
  19. 19. 1. (chatterbox/concept_01.py)
  20. 20. 1. +
  21. 21. 1. +
  22. 22. 2. (chatterbox/concept_02.py)
  23. 23. 2. - +
  24. 24. 2. + home + route
  25. 25. 3. (chatterbox/concept_04.py)
  26. 26. 3. + chatter.route(request.json)
  27. 27. 3. + +
  28. 28. 3. + response
  29. 29. Response State rule Pythonic , Depth
  30. 30. chatterbox chatterbox.py
  31. 31. 2.
  32. 32. 1. setup.py pipenv lint testing coverage CI examples
  33. 33. setup.py kennethreitz/setup.py
  34. 34. setup.py
  35. 35. setup.py - long_description Markdown Descriptions on PyPI
  36. 36. setup.py - etc List of classifiers
  37. 37. setup.py - etc
  38. 38. Python 2 or 3 Python 2 Python 3
  39. 39. Python 3.4 New modules asyncio enum pathlib
  40. 40. Python 3.5 New syntax async/await a @ b *, ** unpacking (e.g. {'x': 1, **{'y': 2}}) New modules typing
  41. 41. Python 3.6 New syntax F f'Answer is {value}' async
  42. 42. Pipenv • • Pipfile, Pipfile.lock • • pipenv install --dev • pipenv shell (source venv/bin/activate) pipenv lock -r > requirements.txt pipenv lock -dr > requirements-dev.txt
  43. 43. Lint & Formatter • PEP8 • pylint, flake8 linter • autopep8, yapf, black formatter • .pylintrc config • pylint --error-only tox
  44. 44. Testing • unittest, pytest • pyenv + tox: • detox: • tox.ini CI
  45. 45. Testing - pytest • unittest + nose < pytest • • • fixture •
  46. 46. Testing - pytest • unittest + nose < pytest • • • fixture • The cleaning hand of pytest setUp, tearDown
  47. 47. Testing - pytest • unittest + nose < pytest • • • fixture • The cleaning hand of pytest
  48. 48. Testing - pytest • unittest + nose < pytest • • • fixture • Pytest Flask DB Python pytest fixture Switching from nose to py.test at Mozilla
  49. 49. Testing - tox • pyenv + tox: • detox: tox
  50. 50. Coverage • pytest-cov HTML •
  51. 51. Coverage • codecov, coveralls: CI , Integration • PR chatterbox#6
  52. 52. CI • tox • pytest pylint • coverage • travis appveyor
  53. 53. CI tox.ini
  54. 54. CI tests pylintsource codecov tox travis & appveyor Python 3.4 Python 3.5 Python 3.6 pytest push
  55. 55. Examples ,
  56. 56. 2. TDD stdlib
  57. 57. requests-html
  58. 58. 1 2
  59. 59. chatterbox Target: Description Add: Things, Fix: What bug, Change: Logic
  60. 60. TDD • • , • • TDD . • Examples
  61. 61. TDD Red Green Refactor
  62. 62. TDD
  63. 63. TDD
  64. 64. stdlib • • functools: wraps, partial • itertools: Response • contextlib: sqlite cursor, contextmanager • collections: ChainMap, 3.4 dict unpacking • abc: ABCMeta, abstractmethod • pathlib: os.join, os.path
  65. 65. functools wraps partial reduce singledispatch
  66. 66. itertools & operator Response
  67. 67. 3 message itertools & operator
  68. 68. itertools & operator 2 keyboard
  69. 69. 2 keyboard6 message itertools & operator Text Photo Button Text Button X
  70. 70. itertools & operator
  71. 71. itertools & operator
  72. 72. itertools & operator
  73. 73. itertools & operator
  74. 74. itertools & operator 12
  75. 75. contextlib context
  76. 76. contextlib
  77. 77. • chatterbox generator • CPython generator pickle • generator
  78. 78. - chatterbox State generator pickle
  79. 79. - chatterbox user App 1 App 2 Memory Memory
  80. 80. - chatterbox generator pickle State
  81. 81. • , • •
  82. 82. & • 0.1.0 & git tag • • setup.py version GitHub • changelog
  83. 83. & diff,
  84. 84. & GitHub
  85. 85. API • - README , • - ( , ), • - , , • - python.apichecklist.com
  86. 86. API API
  87. 87. 3.
  88. 88. : Getting started, changelog, sphinx read the docs CONTRIBUTING.md, GitHub README
  89. 89. • Semantic versioning (e.g. Python 3.6.5) • , • , , • 1.0.0
  90. 90. • Calendar Versioning (e.g. Pipenv 2018.7.1) • Ubuntu, pytz, PyCharm, certifi • (pip), outdated (pytz, certifi), (Ubuntu, Pipenv)
  91. 91. • • • : Getting started • : api • sphinx read the docs (sphinx , )
  92. 92. README , doctoc ToC
  93. 93. GitHub • .github • CONTRIBUTING.md: . • ISSUE_TEMPLATE.md: , OS, python , , pip freeze • PULL_REQUEST_TEMPLATE.md: , •
  94. 94. GitHub CONTRIBUTING.md
  95. 95. GitHub ISSUE_TEMPLATE.md
  96. 96. GitHub
  97. 97. • CI: • • pypi : stable, unstable • • : licenselicense MITMIT buildbuild passingpassingbuildbuild passingpassing pypipypi v0.2.4v0.2.4 pythonpython 3.4, 3.5, 3.63.4, 3.5, 3.6 codecovcodecov 92%92%
  98. 98. README • MD, RST: pypi Markdown • README • - , , , , , • read the docs
  99. 99. • • • ( Close #4, Fix #3 ) •
  100. 100. • • , JungWinter/chef-hong
  101. 101. JungWinter/chef-hong unmaintained
  102. 102. • chatterbox.py • , , • • hackernews, reddit, medium
  103. 103. ,
  104. 104. - Go - Tox, Travis Codecov - : pytest, Travis CI, Docker -
  105. 105. winterj.me@gmail.com JungWinter res_tin

×