tags | aliases | cssclass | |
---|---|---|---|
💽 |
|
- First,
pip install isort
& installisort
from VSCode extensions - Then, to make
isort
compatible withblack
, create a pyproject.toml file at the root of your repo. - Add the following to this file:
[tool.isort] multi_line_output = 3 include_trailing_comma = true force_grid_wrap = 0 line_length = 88 profile = "black"
- Edit /.vscode/settings.json and configure
black
andisort
by adding:
{
"[python]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"python.formatting.provider": "black",
"isort.args": ["--profile", "black"],
}
source.organizeImports: true
runsisort
automatically upon saving document.
🔗 Links to this page: [[Python]]