Get the latest tech news

Switching Pip to Uv in a Dockerized Flask / Django App


I noticed about a 10x speed up across a number of projects, we'll avoid using a venv and run things as a non-root user too.

You only need to add your top level dependencies, uv will make a lock file for you automatically which is somewhat comparable to what pip freeze would produce except uv’s lock file has proper dependency trees and is way better. In both cases I extracted their install commands to a separate script so it’s easy to either run at build time in the Dockerfile (as seen above), or by running it as a command at run-time to make sure your lock file gets updated on your host machine through a volume. ./run deps:install Build a new image and volume mount out a new lock file It’s mainly doing docker compose build and running bin/uv-install inside of a container which has a volume mount so your host’s lock file gets updated

Get the Android app

Or read this on Hacker News

Read more on:

Photo of pip

pip

Photo of django app

django app

Photo of dockerized flask

dockerized flask

Related news:

News photo

Using pip to install a Large Language Model that's under 100MB

News photo

Performance improvement plans are on the rise