Package Management with `uv
Docs: https://docs.astral.sh/uv/
cd your-project
uv venv # Creates .venv in project directory
source .venv/bin/activate # or: . .venv/bin/activate
uv pip install pandas numpy
Advantages over managing with conda: conda can introduce dependency duplication. uv uses aggressive caching to avoid re-downloading (and re-building) dependencies that have already been accessed in prior runs. Let’s say two projects are using the same ‘pandas’ version. Even if you have a separate environments for the projects, uv does not install the dependency twice (like it would do with conda environments).
uv commands:
Install uv (first time):
curl -LsSf https://astral.sh/uv/install.sh | sh
Setup project:
uv init && uv venv --python 3.12
Activate environment:
source .venv/bin/activate
Install project in editable mode:
uv pip install -e .
Add dependencies:
uv add pandas
Add dependencies (pip compatibility):
uv pip install pandas
Running scripts
uv run example.py
Using Jupyter from VS Code
Create a project.
uv init project
Move into the project directory.
cd project
Add ipykernel as a dev dependency.
uv add --dev ipykernel
Open the project in VS Code.
code .