-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
What's the problem this feature will solve?
Pip allows installing from VCS URL references such as git+https://github.com/org/repo@{ref}#egg=name.
When {ref} points to an immutable revision (ie a commit hash / sha in case of git),
it would help performance to cache the wheel that was built from that reference,
and subsequently reuse it.
Describe the solution you'd like
I'm willing to implement the PR myself.
My plan is to add a is_immutable(cls, revision/link) to the VersionControl class.
In the case of git it would check revision looks like a sha ('^[a-fA-F0-9]{40}$').
Then exploit it in caching mechanisms.
Potential issues:
- something that looks like a sha might also be a branch name which would therefore not be immutable: I believe this is not an issue in practice because nobody would name a branch
with exactly 40 characters in a way that git could confuse with a a sha in case of binary wheels (ie containing C code), the VCS URL may not contain enough information to ensure a reproducible build, as some build parameters may be environmental; in such cases the cache may trigger returning a wheel that otherwise would have to be rebuilt (eg for a different architecture): I'm not seeing any practical issue here either; if there would be a risk we can consider controlling the feature with a flag ([update] pip's wheel cache takes care of this as wheel names contain platform specific tagssuch as --(no)-vcs-cache)
Alternative Solutions
I currently have a pip wrapper that does something close, but I thought it would be useful to others, so I propose to implement it in pip itself.
Before attempting an implementation, I wanted to check if such a feature is of interest to pip maintainers, or if any of the potential issues would be considered blocking.
Additional context
N/A