Wednesday, January 07, 2026

Setup local dev environment 2 (UV, python virtual environment, python in Visual Code)

Setup local dev environment 2 (UV, python virtual environment, python in Visual Code)


UV

We use uv instead of pip for package management because uv is faster, safer, and manages dependencies per project automatically.

UV creates virtual environments, installs packages, locks dependencies, and runs Python — automatically and safely per project.

uv replaces pip + venv + pip-tools with a single, much faster tool.

Key idea:

You work in a project folder, and uv makes sure the right Python + the right packages + the right environment are always used — even without activating a virtual environment.

1. download and install UV for window 

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

Reference Installation | uv

2. create folder prepare for the project

C:\project\database_agent


3) Inside c:\project\database_agent folder, run the below

UV init

it Creates a modern Python project folder structure as below inside c:\project\database_agent folder:

database_agent/ ├── .venv/ ├── pyproject.toml ├── README.md └── .gitignore

4) Creates the project’s Python virtual environment (.venv) and prepares it to be used by uv.
uv init

database_agent/ ├── .venv/ ├── pyproject.toml ├── README.md └── .gitignore
└── .venv

5) Open Visual code, file->open folder c:\project\database_agent

6) in Visual Code- >extention - > install python and pylance

7) Setup python interprate
visual code -> view- > palatte -> python: select interpreter

8) select interpreter from environment create by UV just now;
python 3.13.11 is the python version i create with UV
python 3.13.11 (database agent) .\venv\scripts\python.exe

9) Validate we use the right virtual environment
Visual code-> Terminal -> New terminal
If the following is shown, the environment is set up correctly and the virtual environment we created is being used.

(database-agent) C:\project\database_agent>

No comments: