uv icon indicating copy to clipboard operation
uv copied to clipboard

Add `pip list --outdated`

Open pfmoore opened this issue 5 months ago • 17 comments

          `pip list --outdated` is also a useful feature.

Originally posted by @ismail in https://github.com/astral-sh/uv/issues/1401#issuecomment-1947899132

Creating a separate issue for visibility, as the issue for creating the uv pip list command has now been closed as complete. Apologies if I missed an issue that already requested this - feel free to close this as a duplicate if that's the case.

I use pip list --outdated all the time (more than any other form of pip list, probably). It would be really useful to have in uv as well.

pfmoore avatar Mar 04 '24 11:03 pfmoore

@zanieb @charliermarsh I was wondering if there were any plans for adding this feature in the coming releases? This is one of the last pieces of the puzzle for our full transition to uv from pip. Any kind of ball-park estimate of if/when would help with our internal planning 🙏

timleslie avatar Mar 18 '24 02:03 timleslie

We don't have any immediate plans to implement this although it seems like it wouldn't be particularly challenging (we have all the components needed for this).

Can you share more about your use-case?

I'd be happy to review a contribution adding support for this.

zanieb avatar Mar 18 '24 02:03 zanieb

Thanks for the reply. We have a somewhat complicated dependency management process which precludes us from using tools like renovate or dependabot on our repo. As such we use pip list --outdated --format=json together with some custom postprocessing of the output and our pyproject.toml to create a list of updatable packages.

From that point of view this is more of a "nice to have" rather than a show-stopper, but for our team this functionality gives us a big quality of life improvement in our DX.

I'm happy to take a swing at the implementation if all the pieces are there 🤞

timleslie avatar Mar 18 '24 02:03 timleslie

(And while I have you, many thanks for embarking on this project. pip install times have been a thorn in our side for an eternity, and uv is an absolute game changer for us 🙏)

timleslie avatar Mar 18 '24 02:03 timleslie

Thanks for all the kind words :) that's an interesting use-case but it makes some sense to me. I imagine it'd make sense to have a future workflow that does not depend on listing the installed packages and can just give you metadata directly from a lockfile... but we can think more about that separately.

Feel free to give it a try. I'm happy to provide any guidance. I'd look at the pip_install implementation and the Plan.reinstalls field.

zanieb avatar Mar 18 '24 14:03 zanieb

Sounds good, I'll try to chip away at this over the coming days and see where I get to. So far I've got a build going and added the CLI arg, so I now I just need to fill in:

    if outdated {
        ...
    }

Simple :-) Just getting familiar with the resolver structs and how all the pieces fit together. I'll reach out with any questions and ship a draft PR for feedback when I have something to look at. pip_install and Plan.reinstalls sound like good pointers 👍

timleslie avatar Mar 20 '24 01:03 timleslie

@zanieb I've pushed up a WIP branch as #2582 which explores my first attempt. I'd appreciate any feedback on whether this is an appropriate direction, or whether there's an alternate path that might involve less noisy code 🤔

timleslie avatar Mar 21 '24 05:03 timleslie

i am writing autotests, and one of them is checking for oudated dependencies

i use pip list --outdated --format=json

and it is sooo slow

i hope uv will be much faster

waiting for the pull request to be accepted

gmankab avatar Apr 03 '24 07:04 gmankab

FWIW I think that the lack of pip list -o and pip list --pre are the last two items I need to replace all usage of pip and pip-tools with uv (when installed) in my project, zpy. Although if uv always acts like --pre, that would be fine as well.

AndydeCleyre avatar Apr 11 '24 21:04 AndydeCleyre

How can one upgrade all packages in a venv without this command (or pip freeze --local, which also isn't supported)? Isn't this a really common task? It's been amazingly hard (but possible), for many years now, to do this with python / pip. Without these two commands in uv one has to crawl back to slow pip.

mralusw avatar Apr 14 '24 04:04 mralusw

@mralusw You can keep track of the packages in requirements+lock files, upgrade those, then sync.

$ uv pip compile -U requirements.in -o requirements.txt
$ uv pip sync requirements.txt

Or without any locking or syncing, just listing top level pkgs, this may do:

$ uv pip install -Ur requirements.in

Otherwise you might collect the names from

$ uv pip list --format json

then uv pip install -U them.

AndydeCleyre avatar Apr 14 '24 05:04 AndydeCleyre

Just an opinion at here: use it as separated command, like pip update, which takes requirements.txt (compiled versions {pkg}=={version}) as input and output is updated list. for current venv and its installed packages in it we can then use uv pip freeze | uv pip update.

Also, fwiw I opened a enhancement request for uv pip freeze in https://github.com/astral-sh/uv/issues/3141

T-256 avatar Apr 19 '24 14:04 T-256

hello, is there any progress with implementing this?

gmankab avatar Apr 27 '24 16:04 gmankab