Can others
reproduce your results? Recipes for using uv and pixi
to manage Python dependencies

James Thomas, j.thomas@bristol.ac.uk

2025-09-09

You should try uv and pixi in your projects

  • What can uv and pixi do?
  • Some common pitfalls when using pip and conda
  • How these are addressed by uv and pixi
  • Practical steps and recipes for using them in projects

QR code to the online resources

What can uv and pixi do?

Like venv/pip or conda

  • create virtual environments
  • install packages
  • uv: PyPI
  • pixi: conda-forge (or PyPI)

Like poetry, pipenv or pip-tools

  • reproducible dependency installations using a lockfile

Like pyenv

  • install multiple python versions

Like pipx

  • install system-wide tools

And… a shared cache…

Motivations for
using better tools

Why not just use pip?

  • pip will allow you to install incompatible dependencies
    if you don’t install them all at the same time

    pip install -r requirements.txt
    pip install matplotlib  # don't do this!
  • difficult to keep track of direct dependencies of a project
    (the ones you intended you use, not just all the dependencies)

pip will allow you to install incompatible dependencies
if you don’t install them all at the same time

Why not just use conda?

  • conda has a faster solver to determine version compatibility (libmamba)

but

  • developing across different platforms is difficult
  • still difficult to keep track of direct dependencies
  • not everyone wants the conda ecosystem

developing across different platforms is difficult

How do uv and pixi
make your life easier?

Package installation, environment management

uv pixi
Configuration
and lockfile
pyproject.toml
uv.lock
pixi.toml or pyproject.toml
pixi.lock

Package installation, environment management

uv pixi
Configuration
and lockfile
pyproject.toml
uv.lock
pixi.toml or pyproject.toml
pixi.lock
Init a project uv init --python 3.x pixi init
Add a package uv add pandas pixi add python=3.x pandas
Run python
a script
uv run python
uv run my_script.py
pixi run python
pixi run python my_script.py

Package installation, environment management

uv pixi
Configuration
and lockfile
pyproject.toml
uv.lock
pixi.toml or pyproject.toml
pixi.lock
Init a project uv init --python 3.x pixi init
Add a package uv add pandas pixi add python=3.x pandas
Run python
a script
uv run python
uv run my_script.py
pixi run python
pixi run python my_script.py
List packages uv pip list
uv tree
pixi list
pixi tree
Update .lock/env
and packages
uv sync
uv sync --upgrade
pixi install
pixi update

Using uv

Install Init Add Run
docs.astral.sh/uv uv init --python 3.x uv add PACKAGE uv run python
uv run my_script.py

Using pixi

Install Init Add Run
pixi.sh pixi init pixi add python
pixi add PACKAGE
pixi run python
pixi run python my_script.py

Multiple platforms with pixi

pixi workspace platform add ...

Recipes
and quality fo life improvements

Projects in uv

Init project Project script Inject packages
uv init --package uv run test-coin uv run --with jupyter jupyter-lab

Projects in pixi

Init project Project tasks
pixi init --format pyproject pixi run test-coin (uses typer)
pixi run lab

System-wide tools

Without installing Install system-wide
uvx COMMAND uv tool install PACKAGE
pixi exec COMMAND pixi global install PACKAGE

Listing packages

List Tree (why do I have this package?)
uv pip list uv tree [--package PACKAGE] [--invert]
pixi list pixi tree [PACKAGE] [--invert]

Scripts with inline metadata PEP 723

uv init --script my_script.py
uv add --script my_script.py PACKAGE

Wrapping up

  • Find out more: 🔗 docs.astral.sh/uv, 🔗 pixi.sh

  • Use for new projects

    • uv if PyPI, pixi if Conda
    • package in src/
    • commands uv run analysis, pixi run analysis
  • When working with someone
    new to Python

    • uv run ... could be in a script
    • pixi run dashboard
      only command they need?
  • Easier than conda/pip by themselves