Python environments: uv
satya - 6/29/2025, 8:38:36 AM
is there a diff between creating a python venv through venv or uv venv?
is there a diff between creating a python venv through venv or uv venv?
Search for: is there a diff between creating a python venv through venv or uv venv?
satya - 6/29/2025, 8:47:29 AM
My github article: previous notes on uv
satya - 6/29/2025, 9:36:14 AM
uv venv equivalence
uv venv
//is equivalent to
python -m venv .venv
//Creates a sub directory .venv
satya - 6/29/2025, 9:37:26 AM
The -m means
- python a.py
- //runs a file anywhere in python path
- python -m a
- //runs a module in the available modules
satya - 6/29/2025, 10:02:36 AM
uv run a.py behavior
- if .venv exists, uses it as the dependency resolver cache
- if project.toml exists, resolves by installing dependencies into the .venv
- similar to uv pip install
- creates a uv.lock file in the process
- then runs the a.py
satya - 6/29/2025, 10:03:38 AM
In other words you can do this
//create a .venv for keeping vscode happy
uv venv
//ensure there is a project.toml and run your .py file
uv run a.py