-
Notifications
You must be signed in to change notification settings - Fork 1.5k
"uv run" runs resolve too much #7538
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
Comments
The dependencies of that package need to be resolved still. How long is it taking? |
It does not happen every time I run the program. |
Here you're not pinning all versions, just the version of Related #6318 |
I was under the impression that |
If the same script is run a second time immediately after the first one, |
I don't really get it, the resolver runs in 1ms in subsequent operations
I think we'd need a better example to help here. |
FYI, the big help for me was adding the I would prefer uv to try and run first without making any HTTP calls, and only hit the network if it can't resolve the dependencies from the cache. I do wonder if this is what the user is facing, very slow but responding HTTP responses. |
@zanieb if you rerun it with uv immediately after it will be fast. But when i you run after a while it will be slow.
I think this could be much improved |
I still need a clearer MRE with logs to do anything to help you here. |
I've only had issues when I've had network problems where the network is intermittently working, not sure how to reproduce. |
The MRE is this file
Run with
Sometimes uv decides to resolve dependencies (again!) and this will be printed:
Tried with Again, note that running it many times in rapid succession will be fast. But the first execution after a pause will show this slowness |
@zanieb reopen? |
I think this is by design? We refresh the dependencies every 10 minutes or so. |
What's the motivation for that? It's definetly problematic on poor network connections (like I say, I reccomend |
When we see the list of dependencies, we have to resolve them -- there's no lockfile. So by default we would adhere to PyPI's 10-minute caching headers. |
Ah I see, I guess it would require something non-trivial to "fix" then, e.g. implicitly creating a lockfile for each script and caching the lockfile. |
Yeah we could do that internally. It's a good idea. My only concern is that it might be a bit confusing if you run a script, then come back to it a few weeks later and we don't automatically use "newer" versions of the dependencies, because we're implicitly using a lockfile behind the scenes. |
We could at least cache with a longer timespan in that context. |
I think the user experience goes both ways, I found it confusing that once I've run once it downloads dependencies again (sometimes they're big and it's noticable waiting for them even on my fast home connection). I would have expected to have to run But I'm sure some users may feel the opposite. |
FYI, I created a specific feature request for this: #9688. |
I have a script that starts with
It is supposed to run fast but uv often starts with a blocking message "⠷ Resolving dependencies...". But the single depedency is pinned to a version so if it is installed there is nothing to resolve.So I think uv should be able to start this script faster.
Right now
uv run
is too slow for most of my use cases since it resolves way too much.The text was updated successfully, but these errors were encountered: