In this task you will install and configure a formatter named yapf
for your editor.
yapf
only cares about whitespace, it will not modify any other characters.
You already have this setup configured in the root directory of this project (given that you completed the local setup in README). For this task, you can open a new window in VSCode from the folder clean
. That way, you will start without any interpreter or vscode settings.
Yapf have several configurations, for example always two empty lines before a class declaration.
This task is intended to be performed locally on your host machine, not inside docker container. The local setup from README is required for this task.
Table of contents:
Install yapf
through pipenv
from root of project on host machine.
Solution
From root of project on host machine:
pyenv exec pipenv install yapf
Open a new window in VSCode from the folder clean
and select the .venv
folder as interpreter.
See README step 4 and 5 for these instruction.
Tell VSCode to format file on save with yapf
.
Solution
Add this to file /.vscode/settings.json:
{
...
// Formatting:
"python.formatting.provider": "yapf",
"editor.formatOnSave": true,
}
👈 Back to Tasks