(no title)
gatvol
|
4 months ago
UV is super fast and great for environment management, however it's not at all well suited to a containerised environment, unless I'm missing something fundamental (unless you like using an env in your container that is).
nickjj|4 months ago
The biggest wins are speed and a dependable lock file. Dependencies get installed ~10x faster than with pip, at least on my machine.
Both of my Docker Compose starter app examples for https://github.com/nickjj/docker-flask-example and https://github.com/nickjj/docker-django-example use uv.
I also wrote about making the switch here: https://nickjanetakis.com/blog/switching-pip-to-uv-in-a-dock...
zahlman|4 months ago
A virtual environment, minimally, is a folder hierarchy and a pyvenv.cfg file with a few lines of plain text. (Generally they also contain a few dozen kilobytes of activation scripts that aren't really necessary here.) If you're willing to incur the overhead of using a container image in the first place, plus the ~35 megabyte compiled uv executable, what does a venv matter?
scuff3d|4 months ago
bognition|4 months ago
In my docker files I use `uv sync` to install deps vs `pip install -f requirements.txt`
And then set my command to `uv run my_command.py` vs calling Python directly.
amingilani|4 months ago
Could you elaborate?
__float|4 months ago
emeraldd|4 months ago
coeneedell|4 months ago
m000|4 months ago
Source? That's an option, but it's not even explicitly mentioned in the related documentation [1].
[1] https://docs.astral.sh/uv/guides/integration/docker/
cyberax|4 months ago
nomel|4 months ago
And lack of non-local venv support [2].
[1] https://github.com/astral-sh/uv/issues/10203
[2] https://github.com/astral-sh/uv/issues/1495
hodanli|4 months ago
diath|4 months ago
What's the problem with that?
You just make your script's entry point be something like this:
nodesocket|4 months ago
nicwolff|4 months ago