SlideShare ist ein Scribd-Unternehmen logo
1 von 116
Downloaden Sie, um offline zu lesen
chatterbox.py
winterj.me@gmail.com
JungWinterres_tin
0. 

1. 

2. 

3.
0.
JungWinter/HongikFood
,
API
session, intent, context
POST /message
API 

callback content
1.
2.
PEP8 

if-else
JungWinter/yellowid-flask
1.
JSON response
if-elif-else
1.
2.
3. response
3. response
3
Pythonic
, Depth
JSON response
if-elif-else
1.


(chatterbox/concept_01.py)
1.
+
1.
+
2.


(chatterbox/concept_02.py)
2.
- 

+
2.
+ home

+ 

route
3.


(chatterbox/concept_04.py)
3.
+ 

chatter.route(request.json)
3.
+ 

+
3.
+ response
Response
State rule
Pythonic
, Depth
chatterbox

chatterbox.py
2.
1.
setup.py

pipenv

lint

testing

coverage

CI

examples
setup.py
kennethreitz/setup.py
setup.py
setup.py - long_description
Markdown Descriptions on PyPI
setup.py - etc
List of classifiers
setup.py - etc
Python 2 or 3
Python 2 

Python 3
Python 3.4
New modules
asyncio

enum

pathlib
Python 3.5
New syntax
async/await

a @ b
*, ** unpacking (e.g. {'x': 1, **{'y': 2}})

New modules
typing
Python 3.6
New syntax
F f'Answer is {value}'



async
Pipenv
• 

• Pipfile, Pipfile.lock 

• 

• pipenv install --dev 

• pipenv shell (source venv/bin/activate)
pipenv lock -r > requirements.txt
pipenv lock -dr > requirements-dev.txt
Lint & Formatter
• PEP8 

• pylint, flake8 linter

• autopep8, yapf, black formatter

• .pylintrc config 

• pylint --error-only tox
Testing
• unittest, pytest

• pyenv + tox: 

• detox: 

• tox.ini CI
Testing - pytest
• unittest + nose < pytest

• 

• 

• fixture

•
Testing - pytest
• unittest + nose < pytest

• 

• 

• fixture

•
The cleaning hand of pytest
setUp, tearDown
Testing - pytest
• unittest + nose < pytest

• 

• 

• fixture

•
The cleaning hand of pytest
Testing - pytest
• unittest + nose < pytest

• 

• 

• fixture

•
Pytest Flask DB
Python pytest fixture
Switching from nose to py.test at Mozilla
Testing - tox
• pyenv + tox: 

• detox: tox
Coverage
• pytest-cov HTML 

•
Coverage
• codecov, coveralls: CI , Integration 

• PR
chatterbox#6
CI
• tox 

• pytest pylint 

• coverage 

• travis appveyor
CI
tox.ini
CI
tests
pylintsource
codecov
tox
travis
&
appveyor Python
3.4
Python
3.5
Python
3.6
pytest
push
Examples
,
2.


TDD

stdlib
requests-html
1 2
chatterbox Target: Description 

Add: Things, Fix: What bug, Change: Logic
TDD
• 

• ,


• 

• TDD .


• Examples
TDD
Red Green Refactor
TDD
TDD
stdlib
• 

• functools: wraps, partial

• itertools: Response 

• contextlib: sqlite cursor, contextmanager

• collections: ChainMap, 3.4 dict unpacking 

• abc: ABCMeta, abstractmethod 

• pathlib: os.join, os.path
functools
wraps 

partial
reduce
singledispatch
itertools & operator
Response
3 message
itertools & operator
itertools & operator
2 keyboard
2 keyboard6 message
itertools & operator
Text
Photo
Button
Text
Button
X
itertools & operator
itertools & operator
itertools & operator
itertools & operator
itertools & operator
12
contextlib
context
contextlib
• chatterbox generator 

• CPython generator pickle 

• generator
- chatterbox
State 

generator pickle
- chatterbox
user
App 1 App 2
Memory Memory
- chatterbox
generator pickle State
• , 

• 

•
&
• 0.1.0 & git tag

• 

• setup.py version GitHub 

• changelog
&
diff,
&
GitHub
API
• - README , 

• - ( , ), 

• - , , 

• -
python.apichecklist.com
API
API
3.
: Getting started, changelog, sphinx read the docs

CONTRIBUTING.md, GitHub 



README
• Semantic versioning (e.g. Python 3.6.5)

• , 

• , , 

• 1.0.0
• Calendar Versioning (e.g. Pipenv 2018.7.1)

• Ubuntu, pytz, PyCharm, certifi 

• (pip), outdated
(pytz, certifi), (Ubuntu,
Pipenv)
• 

• 

• : Getting started

• : api 

• sphinx read the docs (sphinx , )
README ,
doctoc ToC
GitHub
• .github 

• CONTRIBUTING.md: .


• ISSUE_TEMPLATE.md: ,
OS, python , , pip freeze 

• PULL_REQUEST_TEMPLATE.md: ,


•
GitHub
CONTRIBUTING.md
GitHub
ISSUE_TEMPLATE.md
GitHub
• 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%
README
• MD, RST: pypi Markdown 

• README 

• - , ,
, , , 

• read the docs
• 

• 

• ( Close #4, Fix #3
)
•
•


•
,
JungWinter/chef-hong
JungWinter/chef-hong
unmaintained
• chatterbox.py


• , , 

• 

• hackernews, reddit, medium
,
- Go 

- Tox, Travis Codecov 

- : pytest, Travis CI,
Docker

-
winterj.me@gmail.com
JungWinter
res_tin

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

The Benefits of Type Hints
The Benefits of Type HintsThe Benefits of Type Hints
The Benefits of Type Hints
 
PyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 TutorialPyCon Taiwan 2013 Tutorial
PyCon Taiwan 2013 Tutorial
 
Reversing the dropbox client on windows
Reversing the dropbox client on windowsReversing the dropbox client on windows
Reversing the dropbox client on windows
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Python Workshop
Python WorkshopPython Workshop
Python Workshop
 
Python入門 : 4日間コース社内トレーニング
Python入門 : 4日間コース社内トレーニングPython入門 : 4日間コース社内トレーニング
Python入門 : 4日間コース社内トレーニング
 
Learn python – for beginners
Learn python – for beginnersLearn python – for beginners
Learn python – for beginners
 
Basics
BasicsBasics
Basics
 
Control Flow
Control FlowControl Flow
Control Flow
 
Pl/Python
Pl/PythonPl/Python
Pl/Python
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
RubyConf Bangladesh 2017 - Core Ruby: How it works
RubyConf Bangladesh 2017 - Core Ruby: How it worksRubyConf Bangladesh 2017 - Core Ruby: How it works
RubyConf Bangladesh 2017 - Core Ruby: How it works
 
PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
Tuples
TuplesTuples
Tuples
 
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)[2014 CodeEngn Conference 10] 정광운 -  안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
[2014 CodeEngn Conference 10] 정광운 - 안드로이드에서도 한번 후킹을 해볼까 (Hooking on Android)
 
pa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processingpa-pe-pi-po-pure Python Text Processing
pa-pe-pi-po-pure Python Text Processing
 
Clean Manifests with Puppet::Tidy
Clean Manifests with Puppet::TidyClean Manifests with Puppet::Tidy
Clean Manifests with Puppet::Tidy
 
Introduction to Clime
Introduction to ClimeIntroduction to Clime
Introduction to Clime
 
Concurrency in Python
Concurrency in PythonConcurrency in Python
Concurrency in Python
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with python
 

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

20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtest
Will Shen
 

Ähnlich wie 오픈소스 라이브러리 개발기 (20)

Python Evolution
Python EvolutionPython Evolution
Python Evolution
 
Python 3000
Python 3000Python 3000
Python 3000
 
Python Interview Questions For Experienced
Python Interview Questions For ExperiencedPython Interview Questions For Experienced
Python Interview Questions For Experienced
 
Commit ускоривший python 2.7.11 на 30% и новое в python 3.5
Commit ускоривший python 2.7.11 на 30% и новое в python 3.5Commit ускоривший python 2.7.11 на 30% и новое в python 3.5
Commit ускоривший python 2.7.11 на 30% и новое в python 3.5
 
Python 3.6 Features 20161207
Python 3.6 Features 20161207Python 3.6 Features 20161207
Python 3.6 Features 20161207
 
Moving to Python 3
Moving to Python 3Moving to Python 3
Moving to Python 3
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
Advance python
Advance pythonAdvance python
Advance python
 
Pycon taiwan 2018_claudiu_popa
Pycon taiwan 2018_claudiu_popaPycon taiwan 2018_claudiu_popa
Pycon taiwan 2018_claudiu_popa
 
2to3
2to32to3
2to3
 
Learn python
Learn pythonLearn python
Learn python
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 
OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11OpenSAF Symposium_Python Bindings_9.21.11
OpenSAF Symposium_Python Bindings_9.21.11
 
Python高级编程(二)
Python高级编程(二)Python高级编程(二)
Python高级编程(二)
 
Python_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. txPython_Haegl.powerpoint presentation. tx
Python_Haegl.powerpoint presentation. tx
 
20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtest
 
Python For Scientists
Python For ScientistsPython For Scientists
Python For Scientists
 
Python Orientation
Python OrientationPython Orientation
Python Orientation
 
Magento code audit
Magento code auditMagento code audit
Magento code audit
 
The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3The Onward Journey: Porting Twisted to Python 3
The Onward Journey: Porting Twisted to Python 3
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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