package version 자동으로 찾기 import importlib.metadata _DISTRIBUTION_METADATA = importlib.metadata.metadata('MyProjectName') author = _DISTRIBUTION_METADATA['Author'] project = _DISTRIBUTION_METADATA['Name'] version = _DISTRIBUTION_METADATA['Version'] Passion/Python 2024.03.02
version sort >>> from distutils.version import LooseVersion >>> versions = ["1.7.0", "1.7.0rc0", "1.11.0"] >>> sorted(versions, key=LooseVersion) ['1.7.0', '1.7.0rc0', '1.11.0'] Passion/Python 2021.02.09
flake8 line_length Python에서 기본 권장 글자수는 80글자지만 요즘은 모니터가 크기 때문에 120글자 정도가 적당해 보인다. .config/flake8 [flake8] max-line-length = 120 Passion/Python 2020.04.04
Python version check Python code를 작성하다보면 모듈이나 문법에 따라서 특정 버전 이상이 필요할 때가 있다. 코드 내에서 버전 체크 방법 import sys assert sys.version_info < (2.7) Passion/Python 2019.06.04
JIRA Project List 조회 https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-project-get The Jira Cloud platform REST API The searcher defines the way the field is searched in Jira. For example, com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher. The search UI (basic search and JQL search) will display different operations and values for the field, based on developer.atlassian... Passion/Python 2019.06.04
print align format format: : 오른쪽 정렬 ^: 가운데 print('=' * 80) print('{:40s}{:>20s}'.format("Test Case", "Test Class", "Status")) print('=' * 80) 결과 ================================================================================ Test Case Test Class Status ================================================================================ Passion/Python 2019.04.19
sort by value from collections import OrderedDict# regular unsorted dictionary d = {'banana': 3, 'apple':4, 'pear': 1, 'orange': 2} # dictionary sorted by value OrderedDict(sorted(d.items(), key=lambda t: t[1])) # OrderedDict([('pear', 1), ('orange', 2), ('banana', 3), ('apple', 4)]) Passion/Python 2017.11.19
matplotlib 한글 폰트 https://financedata.github.io/posts/matplotlib-hangul-for-ubuntu-linux.html Passion/Python 2017.11.01
python virtual environment pip install virtualenvpip install virtualenvwrapper mkdir ~/.virtualenvs update ~/.bash_profile export WORKON_HOME=~/.virtualenvssource /usr/bin/virtualenvwrapper.sh Reload ~/.bash_profile source ~/.bash_profile 환경 생성mkvirtualenv pip install -r requirements.txt Passion/Python 2017.10.24