-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect tool upgrades in uv tool install
#4736
Conversation
uv tool install
|
||
----- stderr ----- | ||
warning: `uv tool install` is experimental and may change without warning. | ||
Installed: black, blackd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a behavior change but I personally think it's ok to copy over the entrypoints even on a no-op. I could probably figure out a way to avoid this as an optimization though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's "okay" but it feels a little weird to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safer and simpler to copy them over every time, avoids any weird issues around trying to detect if the package changed in the environment or the entrypoints getting out-of-sync with the environment.
let environment = installed_tools.environment( | ||
&name, | ||
// Do not remove the existing environment if we're reinstalling a subset of packages | ||
!matches!(settings.reinstall, Reinstall::Packages(_)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems ok to me to only remove this when --force
is provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words: can't we defer to our underlying virtualenv update machinery to manage this by reinstalling packages as required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems okay, yeah.
Don't understand the dreaded Windows failures yet but I'll look at them once approved. |
interpreter, | ||
cache, | ||
)?; | ||
let environment = installed_tools.environment(&name, force, interpreter, cache)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think force
needs to imply deletion of the environment though? This seems a little weird. I think we should only remove the existing environment if the requested Python interpreter is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do that… I feel like force is sorta useful too personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Force would be like: completely ignore whatever already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. It feels weird to mix the purpose for me. I agree removing the environment sounds useful but in what case would someone actually need to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(it seems safe to discuss and address this separately from this pull request)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if the environment was broken and the receipt was out-of-sync, even uninstall
wouldn't remove it...? Maybe I'll change uninstall
to handle that edge case, then remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the environment is broken then --force
totally could / should remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe: if there's no receipt, and the environment exists, we remove it? :)
c53dc5b
to
fa239ea
Compare
773bd2e
to
2a8c8c6
Compare
2a8c8c6
to
270f068
Compare
Summary
For now the semantics are such that if the requested requirements from the command line don't match the receipt (or if any
--reinstall
or--upgrade
is requested), we proceed with an install, passing the--reinstall
and--upgrade
to the underlying Python environment.This may lead to some unintuitive behaviors, but it's simplest for now. For example:
uv tool install black<24
followed byuv tool install black --upgrade
will install the latest version ofblack
, removing the<24
constraint.uv tool install black --with black-plugin
followed byuv tool install black
will removeblack-plugin
.Closes #4659.