Can others
reproduce your results? Using ‘uv’ in a
Python data analysis project
James Thomas
j.thomas@bristol.ac.uk
2025-04-01
Outline
- What is
uv
? (and pixi
?)
- Why might you want to use them?
- How do you configure them?
- Some examples
Note:
- I am not the developer of these tools
- You may well know more than me – tips welcome 😁
What does uv
do?
Similar to venv
, pip
, pip-tools
, poetry
, …
- install
python
and PyPI packages
- manage a virtual environment (
.venv
) and lockfile
and:
- cheap disposable environments (
jupyter lab
, pytest
)
- inline script metadata (recreating bugs, demos)
- globally-accessible tools with
uvx
(ruff
, visidata
)
- cross-platform, easy to install, fast
What does pixi
do?
Similar to uv
, …
- install
conda
packages (python
or R
) or PyPI packages
- manage a virtual environment (
.pixi
) and lockfile
and:
- task runner
- globally-accessible tools (sync between devices)
- cross-platform, easy to install, fast
What are lockfiles and why use them?
What about the workflow with uv
?
Configuring uv
using pyproject.toml
Applying this in a data science context
Other tips
Wrapping up
Find out more: 🔗 docs.astral.sh/uv (and 🔗 pixi.sh)
Use for new projects
uv
if PyPI (pixi
if Conda)
- package in
src/
- commands
uv run test-coin
When working with someone
new to Python
uv run ...
could be in a script
Don’t use pip
/conda
by themselves
Bonus material - pixi