- Install the following:
- Open command palette in VSCode with Cmd + Shift + P
- Type and select
Preferences: Open Workspace Settings (JSON)
- Copy and paste the following settings into your workspace settings file:
{ "notebook.formatOnSave.enabled": true, "python.analysis.typeCheckingMode": "strict", "python.analysis.inlayHints.functionReturnTypes": true, "python.analysis.inlayHints.variableTypes": true, "python.analysis.autoImportCompletions": true, "[python]": { "editor.formatOnSave": true, "editor.defaultFormatter": "charliermarsh.ruff", "editor.codeActionsOnSave": { "source.fixAll": "always", "source.organizeImports": "always" } } }
- Save the settings to apply them. This will save a file in the file
.vscode/settings.json
. - Make sure
.vscode/settings.json
file is tracked in git by runninggit add .vscode/settings.json
.
Now, your VSCode is all set up for an optimized Python development experience!