What's the easiest way to get pantsd to not be inv...
# development
b
What's the easiest way to get pantsd to not be invalidated when I touch files in the Pants repo? I've tried: • Running
pants
from a pex instead of
./pants
• Adding
"!**/*.py",
to the
pantsd_invalidation_globs.add
From the docs, this seems relevant:
Pants's own code, plugins, and
--pants-config-files
are inherently invalidated.
e
So you consciously want pantsd to be running on different code than you're editing?
b
Yup! I'm timing my change with a "warm" (but not hot) cache. So I'm lightly editing a few files and re-running. I want the cache to warm for everything that isn't related to just touching my files. --- I'm also using Pants' repo kind of like a client repo, I suppose.
What ends up happening is I see repeated work in the output (making me think pantsd got restarted). Like "Mapping all addresses to targets" (dunno the exact phrase) and downloading PEX's pex.
p
somewhat of a known issue: https://github.com/pantsbuild/pants/issues/9902 We use
pantsd_invalidation_globs.add
and exclude all of our code that doesn't run in pants (we do have some pants plugin code in our repo, so we still want to invalidate on that). Having said that... pants understand dependencies now, so it should be able to do it automatically.
e
I'm not sure there's an easier way than to edit the bit of Pants code that adds the PYTHONPATH invalidation globs. This invalidation was unanimously met with cheers after years of fighting hard to understand apparent but not really bugs when hacking on Pants.
1
h
You can change _test.py files without invalidating Pantsd
b
@enough-analyst-54434 I'm OK with hacks for this 🤓 I'll try that. @hundreds-father-404 I see that
"!*_test.py",
is in the invalidation globs, so that's what made me think to try
"!***/**.py"
That seemed to work, although I need to bump pantsd memory cap
👍 1
w
Running 
pants
 from a pex instead of 
./pants
^ this works well. i also tend to use
--loop
, since it will not restart
pantsd
until the client disconnects