Confusing documentation for `uvx`
Sorry if this is something obvious, but I am very confused on the difference between a uvx <package> invocation and uvx <package>@latest. Through my own testing, uvx <package> seems to always install the latest version even if a cached version is available.
>uvx [email protected] -V
Installed 1 package in 293ms
ruff 0.6.0
>uvx ruff -V
Installed 1 package in 290ms
ruff 0.6.2
Reading the documentation had me even more confused as it seems to be contradicting itself. The linked section states that:
uvx will use the latest available version of the requested tool on the first invocation. After that, uvx will use the cached version of the tool unless a different version is requested, the cache is pruned, or the cache is refreshed
But then immediately proceeds to contradict the statement by saying:
A subsequent invocation of uvx will use the latest, not the cached, version.
And then goes back to saying:
But, if a new version of Ruff was released, it would not be used unless the cache was refreshed.
Would appreciate it if someone could help clarify this, and again, I apologize if I am just missing something obvious.
Oops, yeah sorry this is really confusing. I think it's roughly like this:
- If you request a specific version, we'll respect the requested version and we'll cache it, e.g. as
[email protected] - Requests without a version will fetch the latest version and cache it, e.g. as
foo - Subsequent requests without a version will use the
foocached version- If the library releases a new version, we won't fetch it
- If you use
foo@latest, we'll refresh the cache and fetch the latest version again and cache it, e.g. asfoo
This is, at least, the intent of what I wrote. I'm actually not entirely sure it's correct, and I think it needs to be rephrased.
@charliermarsh would you be willing to take a look since you implemented the caching?
If the library releases a new version, we won't fetch it
I think this is the part that got me confused because in my experience that wasn't the case. Case in point, uvx ruff actually fetched the latest release of ruff for me this morning even without the @latest flag.
>uvx ruff -V
Installed 1 package in 164ms
ruff 0.6.3