Mastering 'uv' in VS Code: The Ultra-Fast Python Setup Guide

Published: (February 5, 2026 at 08:48 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

What is “uv”?

Developed by Astral (the team behind Ruff) and written in Rust, uv is an extremely fast Python package installer and resolver. It aims to be a “one‑stop‑shop” replacement for pip, pip‑tools, and virtualenv. Benchmarks show it to be 10×–100× faster than traditional tools.

Benefits for VS Code users

  • Instant environment setup – no more waiting for dependency resolution.
  • Disk‑space efficiency – optimized global caching.
  • Consistency – the uv.lock file ensures every team member uses the exact same environment.

Step 1: Installing uv

macOS / Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell)

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

After installation, verify it:

uv --version

Step 2: Getting VS Code to Recognize uv

1. Initialize the project and create a virtual environment

# Initialize the project (creates pyproject.toml)
uv init

# Create the virtual environment (creates .venv folder)
uv venv

2. Select the interpreter in VS Code

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P).
  2. Choose “Python: Select Interpreter.”
  3. Pick the Python executable inside the newly created .venv folder.

Tip: If the environment doesn’t appear, add the following to settings.json:

{
  "python.venvPath": ".",
  "python.venvFolders": [".venv"]
}

Step 3: Package Management (uv add / uv sync)

Add a production package:

uv add fastapi

Add a development package:

uv add --dev pytest

When new team members clone the repository, they can sync the entire environment instantly:

uv sync

Step 4: Debugging Configuration (launch.json)

Create a .vscode/launch.json file (or edit the existing one) with the following configuration:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File (uv)",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "justMyCode": true
    }
  ]
}

Now you can set breakpoints and debug your code directly within the uv‑managed environment (press F5 to start debugging).

Pro Tip: Integration with Ruff

Since Ruff is made by the same developers, it pairs perfectly with uv.

  1. Install the Ruff extension for VS Code.
  2. Add Ruff as a development dependency:
uv add --dev ruff
  1. Configure VS Code to use Ruff as the default formatter:
{
  "[python]": {
    "editor.defaultFormatter": "charliermarsh.ruff",
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
      "source.fixAll": "explicit",
      "source.organizeImports": "explicit"
    }
  }
}

Your code will now be linted and formatted at lightning speed on every save.

Conclusion

Switching to uv is perhaps the single most impactful change you can make to improve your Python development experience in 2026. Combined with VS Code and Ruff, you get a development environment that is fast, robust, and modern.

Originally published at:

Back to Blog

Related posts

Read more »