본문 바로가기
Programming/Python

python code reformatter black + pycharm

by Chan_찬 2020. 6. 13.
728x90
반응형

python code reformatter black with pycharm

$ pip install black
$ which black
/../pyenv/path/bin/black  # 이거 복사

pycharm 실행 > Preference > Tools > External Tools > + 클릭

Name: black
Program: /../pyenv/path/bin/black # 위에 복사한 것
Arguments: $FilePath$
Working directory: /../pyenv/path/bin # 복사한 것에서 /black 삭제

Preference > Tools > File Watchers > +버튼 > custom 클릭

Name: black
File Type: python
Scope: Project Files
Program: /../pyenv/path/bin/black # 위에 복사한 것
Arguments: $FilePath$
Output paths to refresh: $FilePath$
Working Directory: $ProjectFileDir$

Advanced options
Auto-save edited files to trigger the watcher 체크 해제
Trigger the watcher on external changes 체크

https://black.readthedocs.io/en/stable/editor_integration.html

728x90
728x90
BIG
Buy me a coffeeBuy me a coffee

댓글