`uv` in the python ecosystem and data science

uv is an incredible tool for the python ecosystem, and the work being done at Astral on improving type-checking/lsp (ty), linting/formatting (ruff), and (of course) package management makes me fairly excited to work in Python.

Commonly, many amateur Python users are in the following two camps:

  1. pip install global dependencies
  2. jupyter notebook kernels

I believe a majority of these bad habits come from using online platforms where users never had to think about dependency management (like Google Cobaloratory ) as well as simple ignorance among users who rely on others to troubleshoot their system when they run into issues.

This is mildly concerning, but not a surprise to me. Any introduction to Python course will cover the pip package manager, but not how it works under the hood or what different types of dependencies mean. Or worse, they’ll skip over pip and move directly to an Anaconda distribution (common in data science).

It doesn’t help that package management is unclear under the official python documentation, which recommends using pipenv , which functions more as an ’environment manager’ rather than a package management solution, wrapping around pip and venv.

The third-party ecosystem for managing Python is also massive, with tools like:

  • hatch
  • poetry
  • pdm … to name a few outstanding solutions.

However, despite the power of these tools (especially hatch), we didn’t really observe much adoption in the amateur Python community. Personally, I really like pdm as it provides a nice bridge for Javascript/Typescript users to jump from npm into the Python ecosystem.

uv functions as an amateur-friendly solution while also being faster/more efficient than its competitors in benchmarks. It inherits many of poetry’s original ideas in project management, but extends it to:

  • one-time scripts (through uv run)
  • command-line tools (through uvx, similar to npx and pipx)
  • compatibility with pip (through uv pip) As if that wasn’t enough, uv is also capable of managing and installing multiple python versions. There are integrations with Docker, Jupyter/Lab, CI/CD pipelines, PyTorch, and serverless runtimes as well.

There is one major caveat however: conda. Anaconda, miniconda, mamba, etc. have plagued Python users for a long time due to being the primary way to install C-based packages. uv cannot help you here !

If you use software like direnv, mise-en-place, pixi, or other shell solutions for managing versions, they may also integrate with uv themselves! I highly recommend checking the documentation to see if they work well together.