Go to your Terminal and type [[pip install black]]
Click on "PyCharm" in the menu bar and then "Settings"
Click this unknown
Click "Tools" and then "External Tools"
Click +
Click on the name field and name your new tool
To add the path for the tool, click + next to the Program Field, then select "PyInterpreterDirectory" and add /black at the end
To add the arguments for the tool, click + next to the Arguments, then select "FilePath"
To add the working directory for the tool, click + next to the Working Directory, then select "ProjectFileDir"
Click "OK"
Click Apply
You've successfully added a tool for formatting files with black
Now you've added a tool, but it doesn't auto-apply on save. For that to happen, follow the rest of the guide.
Running black automatically on file save
While in the Settings window, click "File Watchers"
Click +
Select "<custom>"
Name your File Watcher
From File type dropdown, select "Python"
Documents you might like
0 Selected
This Scribe is in tip-top shape!Leave feedback if there are any issues with this Scribe
Have something to say?Create an account to leave messages for the author to see!
Press space bar to start a drag.
When dragging you can use the arrow keys to move the item around and escape to cancel.
Some screen readers may require you to be in focus mode or to use your pass through key