`uv pip install -U somepkg` should only update the specified package, unless additional upgrades are necessary
Classic pip did the same until a few years ago where they changed the default to --upgrade-strategy only-if-needed for which uv currently does not have an equivalent. The only way to get this behavior is uv pip install -P somepkg somepkg which is a bit ugly since I need to specify the package name twice.
I think this behavior would be more desirable than "upgrade everything" because:
- In most proper production deployments you have lock files anyway and will not use
uv pip install -Uat all - If you have some extra packages in such an environment, you do NOT want updating that package to also update some random dependency (that's actually specified in another package's lock file)
- In a development environment, I guess it's a matter of preference
My suggestion would be to:
- Change the default to match
--upgrade-strategy only-if-needed(or at least implement this option) - Display a notice if any (direct?) dependencies of the specified package could also be updated (maybe only if this does not conflict with version pins of already-installed packages?)
Sounds like you're just looking for --upgrade-package? Why is it a big deal to specify the name twice? Isn't it harder for users to do uv pip install <package> --upgrade --upgrade-strategy eager to update their environment? I've been bitten by this surprising behavior in pip several times in CI.
I'm not particularly opposed to --upgrade applying to all of the "given packages" if we can find a nice way to specify upgrading the environment. I guess --upgrade-strategy isn't bad.
Related https://github.com/astral-sh/uv/issues/7176
Also related: #10097