Skip to content

Instantly share code, notes, and snippets.

@eevmanu
Created January 4, 2023 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eevmanu/62af9c62680ab27a326acf513731375a to your computer and use it in GitHub Desktop.
Save eevmanu/62af9c62680ab27a326acf513731375a to your computer and use it in GitHub Desktop.
VS Code folder settings example / template for a python project
{
// --------------------------------------------------------------------------------
// personal code editor config
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.exclude": {
"**/__pycache__": true,
"**/*.egg-info": true,
"**/.env/**": true,
"**/.venv/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/site-packages/**": true,
"**/.mypy_cache/**": true,
"**/.pytest_cache/**": true,
"build/": true,
},
"search.exclude": {
"**/__pycache__": true,
"**/*.egg-info": true,
"**/.env/**": true,
"**/.venv/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/site-packages/**": true,
"**/.mypy_cache/**": true,
"**/.pytest_cache/**": true,
"build/": true,
},
"files.watcherExclude": {
"**/__pycache__": true,
"**/*.egg-info": true,
"**/.env/**": true,
"**/.venv/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/site-packages/**": true,
"**/.mypy_cache/**": true,
"**/.pytest_cache/**": true,
"build/": true,
},
// "workbench.localHistory.exclude": {}
// "markdown.extension.completion.respectVscodeSearchExclude": true
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python binary
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
// "python.defaultInterpreterPath": "${env:HOME}/.pyenv/versions/3.8.13/bin/python",
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python extra paths to support autocomplete (by pylance LSP)
"python.analysis.extraPaths": [
"${workspaceFolder}/src",
// 👆 python autocomplete still required `__init__.py` files to be able to import modules
],
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python package manager ‣ poetry
"python.poetryPath": "${env:HOME}/.local/bin/poetry",
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python linter ‣ pylint (or flake8)
"python.linting.enabled": true,
"python.linting.lintOnSave": true,
"python.linting.pylintEnabled": false,
// "python.linting.pylintEnabled": true,
"python.linting.pylintPath": "${workspaceFolder}/.venv/bin/pylint",
"python.linting.pylintArgs": [
"--rcfile=${workspaceFolder}/.pylintrc",
// "--max-line-length=88",
// "--verbose"
],
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python formatters ‣ isort, black
// TODO isort conf
// "python.formatting.provider": "black",
// "python.formatting.blackPath": "${workspaceFolder}/.venv/bin/black",
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// python type checking ‣ mypy ...
// "python.linting.mypyPath": "mypy",
// "python.linting.mypyPath": "${workspaceFolder}/.venv/bin/mypy",
// "python.linting.mypyEnabled": true,
// "python.linting.mypyArgs": [
// "--config-file=${workspaceFolder}/mypy.ini",
// // "--follow-imports=silent",
// // "--ignore-missing-imports",
// // "--show-column-numbers",
// // "--no-pretty"
// ],
// ... or pylance LSP
// "python.analysis.typeCheckingMode": "basic",
// "python.analysis.xxx"
// --------------------------------------------------------------------------------
// --------------------------------------------------------------------------------
// only on files with a python file extension
"[python]": {
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 4,
// 👇 because of PEP8 and Black
"editor.rulers": [
88,
120,
],
// 👇 enable if using python formatters
// "editor.formatOnSave": true,
// "editor.formatOnSaveMode": "file"
},
// --------------------------------------------------------------------------------
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment