VSCode python dev env.
Using vscode and uv
to setup a python development environment.
create project using uv
| uv init
# create venv install pytest and update pyproject.toml
|
pytest
pyproject.toml
Add pytest settings
| [tool.pytest.ini_options]
pythonpath = [
"."
]
|
VSCode
Extensions
Settings
VSCode python autocomplete
| "python.analysis.extraPaths": [
"${workspaceFolder}/src"
]
|
ruff
| "ruff.importStrategy": "useBundled",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": {
"source.organizeImports": "always",
"source.fixAll": "always"
},
|
ruff settings
ruff.toml |
---|
| line-length = 88
indent-width = 4
[format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"
|