I had to give a specific version of black this morning. I didn't yesterday. Don't specify the version unless it makes you.
$ cd ~/Envs
$ mkdir black
$ cd black
$ pipenv --python 3.6
$ pipenv install black==18.5b0
$ pipenv run which black
/Users/kirk/.local/share/virtualenvs/black-wkc_P2WA/bin/blackTake note of that last line!
https://marketplace.visualstudio.com/items?itemName=joslarson.black-vscode
Open your user settings and add:
"[python]": {
"editor.rulers": [
99
],
"black.path": "/Users/kirk/.local/share/virtualenvs/black-wkc_P2WA/bin/black",
"python.formatting.provider": "none",
},
Now you can use the command palette to run "Format Document" to run Black on the current file. Down the road, we can set "editor.formatOnSave": true to automatically run it every time you save a file.
The
joslarson.black-vscodeplugin is deprecated and black is supported by the native Python package: https://code.visualstudio.com/docs/python/editing#_general-formatting-settings