Skip to content

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

uv add --dev pytest

pyproject.toml

Add pytest settings

1
2
3
4
[tool.pytest.ini_options]
pythonpath = [
  "."
]

VSCode

Extensions

  • ruff

Settings

VSCode python autocomplete

1
2
3
"python.analysis.extraPaths": [
    "${workspaceFolder}/src"
]

ruff

1
2
3
4
5
6
7
8
9
"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"