uv IS the Future of Python Packaging 🐍📦 (www.youtube.com)
from norambna@programming.dev to python@programming.dev on 30 Sep 2024 15:33
https://programming.dev/post/20061505

via mastodon.social/@hynek/113227146595211210

#python

threaded - newest

dinckelman@lemmy.world on 30 Sep 2024 16:05 next collapse

It’s a really bold claim. Every time a new package manager and/or dependency resolver comes around, we have the exact same headline

ALERT@sh.itjust.works on 30 Sep 2024 17:30 next collapse

have there been a lot of them?

monogram@feddit.nl on 30 Sep 2024 17:51 collapse

pipx, poetry, pipsi, fades, pae, pactivate, pyenv, virtualenv, pipenv

Let’s hope this next one will be the true standard.

sugar_in_your_tea@sh.itjust.works on 30 Sep 2024 18:20 next collapse

We’re using poetry and it solves our problems. I’ll have to look into uv, but I don’t feel in any rush to switch away from poetry.

dallen@programming.dev on 30 Sep 2024 20:43 collapse

I’ve been mostly a poetry guy but have tested out uv a bit lately. Two main advantages I see are being able to install Python (I relied on pyenv before) and it’s waaay faster at solving/installing dependencies.

sugar_in_your_tea@sh.itjust.works on 30 Sep 2024 21:29 collapse

Yeah, it certainly looks nice, but my problems are:

  • everything runs in a docker container locally, so I don’t think the caching is going to be a huge win
  • we have a half-dozen teams and a dozen repositories or so, across three time zones, so big changes require a fair amount of effort
  • we just got through porting to poetry to split into dependency groups, and going back to not having that is a tough sell

So for me, it needs to at least have feature parity w/ poetry to seriously consider.

eager_eagle@lemmy.world on 30 Sep 2024 23:57 next collapse

uv is still faster with a cold cache

and uv does have dep groups

about the second problem, there’s an issue open on writing a migration guide, but migrating manually is not too difficult.

sugar_in_your_tea@sh.itjust.works on 01 Oct 2024 22:05 collapse

I’m not really worried about the migration work, from what I can tell it’s basically just moving a few things around. I’m more worried about losing features the team likes largely for performance reasons.

Our primary use cases are:

  • dev tools - standardize versions of tools like black, pylint, etc; not necessary if we move to ruff, we’ll just standardize on a version of that (like we do with poetry today)
  • tests - extra deps for CI/CD for things like coverage reports

I like the syntax poetry has, but I’d be willing to use something else, like in PEP 735.

One thing we also need is a way to define additional package repos since we use an internal repo. I didn’t see that called out in the PEP, and I haven’t looked at uv enough to know what their plan is, but this issue seems to be intended to fix it. We specify a specific repo for a handful of packages in each project, and we need that to work as well.

I’m currently looking to use ruff to replace some of our dev tools, and I’ll look back at uv in another release or two to see what the progress is on our blockers.

monogram@feddit.nl on 01 Oct 2024 05:56 collapse

You should be using dockers cache mounts

docs.docker.com/build/cache/optimize/#use-cache-m…

sugar_in_your_tea@sh.itjust.works on 01 Oct 2024 22:06 collapse

Good call. We have some other tech debt related to our docker usage, so I’ll add this to the list.

onlinepersona@programming.dev on 01 Oct 2024 10:15 collapse

pyenv, virtualenv, pipenv, aren’t package managers… they are virtual environment managers / creators and use pip for package management.

Anti Commercial-AI license

BitSound@lemmy.world on 30 Sep 2024 18:09 next collapse

It is a bold claim, but based on their success with ruff, I’m optimistic that it might pan out.

dinckelman@lemmy.world on 01 Oct 2024 12:05 collapse

I do enjoy ruff a lot, but only time will tell

solrize@lemmy.world on 01 Oct 2024 01:29 next collapse

There are 14 competing standards…

fnrir@lemmy.world on 01 Oct 2024 11:37 collapse

Relevant XKCD

TriflingToad@lemmy.world on 01 Oct 2024 23:34 collapse

I think of this literally every time I have any issue

beeng@discuss.tchncs.de on 30 Sep 2024 17:49 next collapse

Got toml file support yet? Then I’m happy to talk :)

sugar_in_your_tea@sh.itjust.works on 30 Sep 2024 18:51 next collapse

Looks like it has basic support:

  • required-python = "…"
  • dependencies = [ … ]

Once it gets dependency groups, I’ll try it out. I’m currently using poetry, which works, but I’m always interested in better perf.

eager_eagle@lemmy.world on 30 Sep 2024 23:41 collapse

it already has dep groups; e.g.

uv add --optional staging pytest

then

uv sync --extra staging

to install / uninstall packages accordingly.

They have a –dev shorthand for dev dependencies, but it seems the dependency group PEP is not final, so there isn’t a standardized way of doing this yet.

beeng@discuss.tchncs.de on 01 Oct 2024 05:23 next collapse

Private PyPI too?

We’re coming from poetry but it’s slow and needs its own .venv, so a UV binary would be very nice.

SwordInStone@lemmy.world on 01 Oct 2024 09:02 collapse

yeah, it works with private pypi

beeng@discuss.tchncs.de on 01 Oct 2024 09:46 collapse

I don’t find it in the docs…how to set my PAT?

sugar_in_your_tea@sh.itjust.works on 01 Oct 2024 22:19 collapse

Oh cool, I’ll definitely look into that.

And honestly, the one I need more is a test group for CI, for things like coverage reporting and whatnot. If I can get that and if having multiple package indexes works properly (i.e. it can check my private repo first, and then pypi), I can probably port our projects to uv, at which point it’s an internal discussion instead of a technical one.

eager_eagle@lemmy.world on 30 Sep 2024 23:43 collapse

they do, just use project management commands like uv + { add, remove, sync, lock, run }

gigachad@sh.itjust.works on 30 Sep 2024 18:29 next collapse

In my field we rely on conda and I hate it every day.

db0@lemmy.dbzer0.com on 30 Sep 2024 19:20 collapse

Why, out of curiosity?

gigachad@sh.itjust.works on 30 Sep 2024 19:52 collapse

We do geodata science and rely on some pretty specific C++ libraries that are only distributed via conda. While on unix-based systems it’s possible to get some of them from other channels or even building them from source, we mostly have Windows machines in production where we are not that flexible. Docker is unfortunately no solution due to security concerns.

If you are asking why I hate it: It’s bloated, uses more space than needed and it’s rare I can reproduce an environment from the environment file without running into errors. Using it feels unintuitive, I still google command after years. It was very slow until recently, when the libmamba solver was finally integrated. Last but not least licensing is a pain in the ass.

db0@lemmy.dbzer0.com on 30 Sep 2024 21:08 next collapse

Interesting. We use conda via micromamba for my own project, as it makes the install for end-users much easier when they can just run a shell script, to install python, cuda, and all the dependencies needed.

eager_eagle@lemmy.world on 30 Sep 2024 23:46 next collapse

I share the same frustration trying to replicate an environment. I’m glad I can avoid it these days, the community needs a way out of the conda lock-in.

rutrum@lm.paradisus.day on 01 Oct 2024 16:21 collapse

I’ve been using micromamba/mamba and not had solving issues like I did with conda. Im glad conda integrated libmamba.

Question: why were docker containers deemed security risks?

gigachad@sh.itjust.works on 01 Oct 2024 18:22 next collapse

Yes, mamba is a huge improvement. Regarding docker I can’t really tell you as I’m not an infrastructure guy.

nickwitha_k@lemmy.sdf.org on 02 Oct 2024 04:46 collapse

If Windows, it requires a VM and currently infosec is not keen on virtualization in the hands of users.

BatmanAoD@programming.dev on 02 Oct 2024 13:31 collapse

I’m no expert, but isn’t running in a VM strictly better than running on raw metal from a security perspective? It’s generally more locked down, and breaking out of the virtualization layer requires a separate security breach from gaining access to the running container.

nickwitha_k@lemmy.sdf.org on 02 Oct 2024 15:51 collapse

I would think so as well. Possibly it’s because a local VM is harder for them to monitor.

ertai@programming.dev on 30 Sep 2024 19:39 next collapse

Yet another python packager insane that such a popular language still doesn’t have this basic problem solved.

sum_yung_gai@lemm.ee on 01 Oct 2024 08:38 next collapse

I use poetry and it works really well. I would consider it solved but that doesn’t mean there isn’t the possibility of a better solution.

CodeMonkey@programming.dev on 01 Oct 2024 17:14 next collapse

pip is a perfectly usable package manager and is included in most python distributions now. Is it perfect? No, but it is good enough for every team I have been on.

astrojuanlu@social.coop on 01 Oct 2024 17:15 next collapse

@CodeMonkey @ertai No it is not perfectly usable for all people, all projects, all situations. uv definitely gets much closer to that.

Moc@lemmy.world on 02 Oct 2024 01:23 next collapse

Except that it’s slower than uv and therefore strictly worse for build processes

eager_eagle@lemmy.world on 02 Oct 2024 03:55 next collapse

it’s usable, yet it doesn’t attempt to solve a a third of the problems uv, poetry, and pdm address.

it’s also not hard to end up with a broken env with pip.

uthredii@programming.dev on 04 Oct 2024 17:53 collapse

Putting aside the speed uv has a bunch of features that usually require 2-4 separate tools. These tools are very popular but not very well liked. The fact these tools are so popular proves that pip is not sufficient for many use cases. Other languages have a single tool (e.g. cargo) that are very well liked.

FizzyOrange@programming.dev on 01 Oct 2024 17:59 next collapse

Yeah but this one is actually good. So hopefully it will displace all the others.

ertai@programming.dev on 02 Oct 2024 20:09 next collapse

Glad I use arch btw, pacman manages my python packages so I don’t have to deal with all this mess.

ertai@programming.dev on 11 Feb 2025 12:34 collapse

Why do programming language developpers even feel the need to reinvent package management every time? Like, just use the system’s package manager?

funtrek@discuss.tchncs.de on 30 Sep 2024 20:11 collapse

Just tell me how uv is financed …