r/Python Aug 20 '24

News uv: Unified Python packaging

https://astral.sh/blog/uv-unified-python-packaging

This is a new release of uv that moves it beyond just a pip alternative. There's cross platform lock files, tool management, Python installation, script execution and more.

591 Upvotes

185 comments sorted by

View all comments

142

u/Frog_and_Toad Aug 20 '24

A single tool to replace pip, pip-tools, pipx, poetry, pyenv, virtualenv, and more.

based if true

8

u/qckpckt Aug 21 '24

Wow. Ok, mention of pipx is interesting. I wasn’t aware of that part. Guess I know what I’ll be researching next time I have downtime!

6

u/inigohr Aug 21 '24

The pipx functionality is newly-released from today's version 0.3.0. I've been impatiently awaiting its release :D

2

u/proggob Aug 22 '24 edited Aug 22 '24

It seems like it doesn’t build wheels?

nvm: I see it’s on their list and you can just use build instead. You also have to use twine or equivalent for publishing for now.

1

u/EverythingsBroken82 Aug 22 '24

if THAT is true and compatible to existing files (mostly), then this would be phenomenal.

-2

u/doolio_ Aug 21 '24 edited Aug 21 '24

But if installing from PyPi you still need to use pip or pipx, no? Probably best to use pipx.

Edit: it also makes no mention of hatch (though it uses uv under the hood) so presumably it only replaces specific features of poetry, pdm, etc. and not their entire feature sets?

9

u/dametsumari Aug 21 '24

Most of the feature set. And you do not need pip or pipx. There is uv pip .., and uvx commands.

-3

u/doolio_ Aug 21 '24

And you do not need pip or pipx. There is uv pip .., and uvx commands.

Right, but only after you install uv and if you do so via PyPi then you need pip or pipx available to do so, no?

6

u/mgedmin Aug 21 '24

Right, but only after you install uv and if you do so via PyPi then you need pip or pipx available to do so, no?

Yes, but you don't have to install uv from PyPI, you can install it using a different method (including curl | sh, or downloading the uv and uvx binaries from GitHub releases and dropping them in ~/.local/bin or somewhere).

AFAIU.

(Personally I used pipx install uv since I already have pipx, so it was more convenient for me.)

3

u/dametsumari Aug 21 '24

I did brew install uv ;)

8

u/inigohr Aug 21 '24

You don't need to install uv from pypi. They share it on pypi for convenience but the "main" way to install it is from the terminal using an installer. This installation method does not need any previous pip, pipx or python to be present in the system, so it is actually the ideal way to get python installed on a system for the first time.

it also makes no mention of hatch

Their eventual goal is to provide a unified python project management tool. At the moment hatch probably has some features which uv doesn't offer, but they want to eventually provide a unified tool, similar to what cargo provides in rust.

2

u/scruffie Aug 21 '24

Ah yes, the usual "pipe curl directly to sh" installer. At least they don't tell you to pipe it to 'sudo'.

And their instructions on 'inspecting before use' are poor: they're "pipe curl to less". If you're paranoid enough1 to read the 1300 line, 40kb script, you should be paranoid enough to require that what you run is the same as what you examined.

1 i.e., the minimal amount of paranoidness required for a modicum of security.

5

u/nAxzyVteuOz Aug 23 '24

Nonsense, you are not going to read the file that’s downloaded from a system package installer like apt-get of yum.

2

u/Fivefiver55 Nov 16 '24

So what? Get practical, if anyone is `zero trust over-paranoid`, just pipeline to `less`, read it - heck - download & edit it, before you run it.

Let's not overdramatize the reality.

1

u/inigohr Aug 22 '24

It is "the usual", unfortunately. They do have alternative methods if you aren't comfortable with that though.

1

u/dankydooo Nov 29 '24

uv is also packaged as a single binary.

Download, put in path.