To setup python black as a formatter for VS-Code workspace you need to install it on your virtual env or in your local python with the command:
$ pip install black
Now install the python extension for VS-Code, open your VS-Code and type “Ctrl + p”, paste the line below and hit enter:
ext install ms-python.python
We are almost there. Go to settings in your VS-Code typing “Ctrl + ,” or clicking at the gear on the bottom left and selecting “Settings [Ctrl+,]” option.
Type “format on save” at the search bar on top of the Settings tab and check the box.
Search for “python formatting provider” and select “black”.
Now open/create a python file, write some code and save(Ctrl+s) it to see the magic happen!
Good to know: if Black is not working maybe your python code has some syntax error, recheck the code and test again.
Contact me: linkedin.com/in/marco-belo/