Are there details about how caching works in pants...
# general
g
Are there details about how caching works in pants? Specifically, this answer I'm trying to answer: 1. Under what conditions are PEX files built and why? I've found that if I am using a remote cache and build against a particular git commit (i.e. abc) and then if I wipe out the cache and rebuild again it cancels the build and successfully pulls from the remote cache (as you would expect). I've followed https://www.pantsbuild.org/blog/2022/08/02/optimizing-python-docker-deploys-using-pants; when I wipe out the cache and modify just a first party source file and make a new commit (i.e. xyz) I would expect it to pull the pex deps binary from cache instead of rebuilding it (because 3rd party deps haven't changed), but what I find is that it doesn't do this -- pants rebuilds the deps binary pex. I'm trying to understand why so that I can improve the efficiency of my build.
My assumption is that I would answer this by using pants dependencies. The issue becomes when I've followed the article https://www.pantsbuild.org/blog/2022/08/02/optimizing-python-docker-deploys-using-pants. I don't think it's smart enough to know that only 3rd party deps are a dependency, it sees both first party and 3rd party deps as dependencies for both binary-srcs and binary-deps.
The only solution I can see is to set explicit dependencies on the binary-deps target so that it's only the 3rd party deps. I want to know if there is a better solution.