question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[RFC] caching VCS requirements that are considered immutables

See original GitHub issue

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 (such as --(no)-vcs-cache) [update] pip’s wheel cache takes care of this as wheel names contain platform specific tags

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:closed
  • Created 4 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, Aug 10, 2019

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.

1reaction
cjerdonekcommented, Aug 10, 2019

@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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

RFC 8246 - HTTP Immutable Responses
The immutable HTTP response Cache-Control extension allows servers to identify resources that will not be updated during their freshness lifetime.
Read more >
RFC 8246 - HTTP Immutable Responses - IETF Datatracker
This ensures that a client never needs to revalidate a cached fresh resource to be certain it has not been modified. Status of...
Read more >
RFC 7234: Hypertext Transfer Protocol (HTTP/1.1): Caching
A stored response is considered "fresh", as defined in Section 4.2, ... Therefore, HTTP cache requirements are focused on preventing a cache from...
Read more >
Why both no-cache and no-store should be used in HTTP ...
@Lèsemajesté Most often not. no-cache and max-age=0 say the the item is to be considered stale. This means the it must be revalidated ......
Read more >
611416 - Implement Cache-Control: immutable - chromium
FF/immutable vs Chrome/old vs Chrome/new would be nice if possible. ... Also, this is probably a better link for the cache-control:immutable rfc:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found