Skip to content

Instantly share code, notes, and snippets.

@srcmaker
Last active April 23, 2021 04:24
Show Gist options
  • Save srcmaker/34d00c5a767bf4d0c73a47bd72f33196 to your computer and use it in GitHub Desktop.
Save srcmaker/34d00c5a767bf4d0c73a47bd72f33196 to your computer and use it in GitHub Desktop.
Python 으로 대형 솔루션을 만들 때 점검사항
https://engineering.soroco.com/building-large-scale-systems-and-products-with-python/
아래 내용은 위 URL 에 나온 Soroco 라는 페이지의 회사의 경험을 참고하여 요약한 것임
1. Dynamic Type 언어의 취약점 벗어나기
PEP484 (Type Hint) 의 룰을 따라 코딩한다.
mypy 를 이용하여 PEP484 룰을 강제한다
2. Linting & Style
코딩의 스타일 및 코멘트, 다큐멘테이션 하는 방식을 통일시킨다.
black - formatting
iSort - sorting
flake8 - good syntax, formatting, styling
Naopolean Project
3. Automated Pipelines, Testing, and Security
Test - PyTest
Automation - CI 서비스 ( Circle-CI, Travis ) 또는 On-Premise Runner ( Jenkins )
Security - bandit (코드 내 보안 이슈 찾음), Snyk, PYCE ( 파이썬 바이트 코드 암호화 )
4. Packaging, Dependency, and Hosting
Pakaging Dependency - 패키지 이름 뿐 아니라 버전도 정확히 지정해 주어 다른 쪽에서 인스톨할 때 생길 수 있는 오류를 방지해야 한다
Private Package Repository - Azure Artifacts, Artifactory ( 이상 Cloud), Sonatype's Nexsus ( on Premise)
Package 버전 컨트롤시 tag 를 활용하도록 한다. 즉 pipeline 에서 이 tag 를 읽어 build 배포에 적용하도록 한다.
5. Performance and Scalable Processing in Python
코드 벤치마킹 툴 - PyTest, cProfile, pycallgraph
Jupyter Notebook - %%time 을 이용하여 코드 별 속도 체크 ( 위 툴을 쓰기에 앞서 이 방식으로 충분할 수 있음 )
대량 데이터 처리 - Pandas 를 이용 ( vectorizing, 또는 string operation 인 경우 특히 ). 괄목할 만한 속도차이 있음
성능 점검을 위해 항상 체크해 봐야 할 만한 라이브러리들 - Pandas, numpy, Scikit-learn, Spark mllib, SciPy
추가 참고 라이브러리 - TensorFlow, Pytorch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment