fix: skip wheel cache for local directory links#14080
Conversation
Fixes pypa#14044 This prevents `SimpleWheelCache` from returning a cached wheel when the requirement link points to an existing local directory, such as `Package @ file:///path/to/project`. Added a regression test covering local directory links.
|
Thanks for the PR! Hope you don't mind, but I've added two commits:
|
|
Some design thoughts here: This will always produce the correct result but potentially at a huge performance cost for some users. We could instead tag the source of the cached item and only allow cache to be used in this case when it came from the same file path? |
notatallshaw
left a comment
There was a problem hiding this comment.
My current thinking is we should merge this as a correctness fix and come up with a better caching strategy as a later optimization, perhaps motivated if we get real world reports.
But if another maintainer disagrees feel free to block merging this.
Sorry, what's the concern? I thought pip was supposed to rebuild local project directories? is the concern that we're expanding this and may catch some users off-guard who didn't mind the cached wheels? Like, we do make this claim in the documentation:
The language here is a bit weird since FWIW, I also don't understand how this bug occurs. The reproduction example requires a (seemingly) locally built wheel is manually placed in the cache when the this wheel shouldn't have been cached in the first place. I'm not saying the bug isn't real, but I think we should dig into what's happening exactly first. I'll find some time to do that soon. |
At the moment there is a bug which means this doesn't always happen, some users may be surprised that they previously weren't building and now are. It's definitely correct to be building, but due to Hyrum's Law I'm sure someone is relying on this behavior.
There was a discord discussion about this: https://discord.com/channels/803025117553754132/837243676814999553/1513958096571990086 The user had the issue, thought it was a difference between specifying |
Fixes #14044
This prevents
SimpleWheelCachefrom returning a cached wheel when therequirement link points to an existing local directory, such as
Package @ file:///path/to/project.Added a regression test covering local directory links.