[RFC] caching VCS requirements that are considered immutables
See original GitHub issueWhat’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
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (12 by maintainers)
Top GitHub Comments
Oh excellent - sorry for butting in in that case 😃 The problems of things happening in a mixture of public and private forums.
Sorry @sbidoul for the unwarranted assumption on my part.
@pfmoore He was actually giving me a friendly nudge because he’s waiting on an email from me. 😃 I’m now co-authoring the PEP with him, and he was awaiting a reply from me confirming it’s ready for submission. The list should see an update within the next couple days or so once I get to replying to his email…