The change to have mypy's cache work is great (mak...
# general
b
The change to have mypy's cache work is great (makes our
./pants check ::
runs 10x faster when there's a small change to python code), thank you! However, I noticed that there seems to be a single
cache.db
file per python verison in
~/.cache/pants/named_caches/mypy_cache/
. Does that mean a single cache is used for all invocations of mypy via pants? E.g. I've got multiple check-outs of our internal company repo (sharing a cache seems to make sense between them...), but also the pants repo, and sharing a cache between the pants and our internal one seems a bit unexpected?
w
cc @bitter-ability-32190
b
Yes! IIRC pants has a unique dir for these things per repo. @witty-crayon-22786 is that true of the append cache?
Oh wait, I think we uniqueify a subdir per project route. IIRC
w
Yes! IIRC pants has a unique dir for these things per repo.
mm, we do not
b
No, specifically for mypy we do this
b
Ah, okay! That... doesn't seem to be functioning as I expect in 2.14, e.g.:
Copy code
$ tree ~/.cache/pants/named_caches/mypy_cache/               
/Users/huon/.cache/pants/named_caches/mypy_cache/
├── 3.7
│   └── cache.db
├── 3.8
│   └── cache.db
└── 3.9
    └── cache.db
And the DB's
files.path
s are all relative to source roots, rather than scoped at all
that will always create a directory called
mypy_cache
, but it will create it at a different place in the sandbox each time.
named_cache_dir
and
run_cache_dir
should maybe be swapped
@broad-processor-92400: would you mind filing a bug against 2.14.x for this?
👍 1
b
Oh yeah whoops. You win some you learn some 😅
w
append_only_caches
is definitely not the most obvious API
b
Lol. My heart was in the right place
❤️ 1
w
we probably could do what you were suggesting above and differentiate
append_only_caches
from per-repo caches…
global_named_caches
and
repo_named_caches
…?
b
w
thank you!
b
I'll let you summarise anything frmo this discussion there.
Also I'm assuming
build_root
is (essentially/usually) the absolute path of directory containing the
./pants
script? Does this mean that multiple check-outs (or multiple git worktrees) of a single repo wouldn't be able to share the cache? I guess that sounds bad for concurrency...
b
Pex_root being an example of global? And mypy would be repo?
@broad-processor-92400 yeah. They wouldn't share a daemon either 🤷‍♂️