PyCharm configuration black, code formatting tool

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/u011510825/article/details/82287022

When the cooperative development projects, each individual coding style inconsistencies, maintenance cost increases, the need to develop a unified standard coding style. Currently on the market use more of python code formatting tools YAPF, Black. We introduce the next black today. Source; https://github.com/ambv/black

1. Install python3.6 environment, this is a relatively boring, but python multi-environment management, it is quite easy, with a virtualenv ( https://blog.csdn.net/u011510825/article/details/47980497 )

 

2. Then pip3.6 install black, take the next test file.

 

3. After testing through the command line, indicating that you have successfully installed, the next step is integrated into the pycharm in.

 

4. Select Preference ---> Tools ---> External Tools into the following this page (pycharm version may be different, there are small differences)

Generally you only need to configure the Program and parmeters, the Program, you need to configure your environment to go with a black, Paraments then configure -m black $ FilePath $

 

5. configured, in the region of the code by right-clicking, selecting External Tools in black. You can be friends.

 

You're done, due to the mandatory python3.6, configure it may still not that easy. Today to introduce here, the next presentation YAPF.

Guess you like

Origin blog.csdn.net/u011510825/article/details/82287022