I am noticing that in CI caching `~/.cache/pants/s...
# general
p
I am noticing that in CI caching
~/.cache/pants/setup
doesn't cache any external pants plugins (global.plugins) and those get downloaded on every CI run. any idea which directory should be cached in order to avoid the re-download in every CI run. I found no reference to that in https://www.pantsbuild.org/docs/using-pants-in-ci (note that we use remote caching, so we nuke lmdb_store and named_caches before uploading the data to the CI cache)
e
I think you won't like the answer. By the point we're loading plugins, we're dogfooding the engine; so normal Python backend rules are used. As such, the plugins are mixed in with everything else we download for linting, typechecking, tests, etc. Namely, these are all stored in the local LMDB cache ~/.cache/pants/lmdb_store and they are exploded into a venv in ~/.cache/pants/named_caches (In particular ~/.cache/pants/named_caches/pex_root).
p
so will they come from a remote cache if there is one ? or downloaded and installed from pypi ?
from what I can tell.. there are no requests to the remote cache during that bootstrap run (also no local cache requests either...) so it seems pants doesn't use the cache in a normal way when installing plugins?
e
That's actually likely. We use the engine, but not with all options necessarily wired up since part of collecting all options is gathering plugins and then probing them. That said, caching options are all core GLOBAL options so this need not be the case. Handwaving from my phone, but the nexus of code is here to peer at: + https://github.com/pantsbuild/pants/blob/main/src/python/pants/init/plugin_resolver.py + https://github.com/pantsbuild/pants/blob/main/src/python/pants/init/options_initializer.py
p
ok. will submit an issue on Monday.
w
at the point when we are downloading the plugin, we can’t possibly use the plugin to auth to a remote cache =/
we could intentionally put a smaller local cache somewhere else for bootstrap, but then that would be another thing to configure
p
I would expect the plugins to be stored/installed into the virtualenv where pants is installed (under ~/.cache/pants/setup)
do you happen do know if downloading those plugins uses pip ? so will leveraging the pip cache (i.e. store the pip cache into the CI cache) help here (at least in terms of network calls to download things from pypi)
w
it will, but in our standard cache location:
~/.cache/pants/named_caches
they are not added/installed in the virtualenv: rather, added to the path dynamically
p
yeah... not a good candidate for CI caching since it gets pretty big.
got it.
I'll add a ticket, I think this will need to be addressed down the line... especially if we are going to have plugins and stuff outside the pants repo and people want to use those plugins when remote cache is also used.
👍 1