- Published on
VSCode Python Formatting with Black
In VSCode, open your settings.json (Control+Shift+P, enter 'open settings json', hit enter), and paste this in to enable black formatting on save.
"python.formatting.provider": "black", "editor.formatOnSave": true,
Make sure you have it installed too.
# From the command line: pip install black
Find this useful? I have more VSCode sensible defaults here
This is a part of a series of quick defaults to make your life easier, based on how we show up in search results.
While you're in there, add autosaving and auto linting too. It's handy.
"python.linting.enabled": true, "files.autoSave": "afterDelay", "files.autoSaveDelay": 10000, "python.linting.lintOnSave": true
Want an email when we post?
Free, weekly at most. We hate spam too.