https://pantsbuild.org/ logo
b

bitter-ability-32190

01/18/2022, 4:52 PM
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

enough-analyst-54434

01/18/2022, 4:57 PM
So you consciously want pantsd to be running on different code than you're editing?
b

bitter-ability-32190

01/18/2022, 4:59 PM
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

polite-garden-50641

01/18/2022, 5:01 PM
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

enough-analyst-54434

01/18/2022, 5:01 PM
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

hundreds-father-404

01/18/2022, 5:02 PM
You can change _test.py files without invalidating Pantsd
b

bitter-ability-32190

01/18/2022, 5:03 PM
@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

witty-crayon-22786

01/18/2022, 8:58 PM
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