high-yak-85899
03/14/2022, 10:10 PMIn-repo plugin code should not depend on other in-repo code outside of theThis seems really prohibitive to developing new plugins. I have some custom code generation that uses other internal libraries to verify the generated code along the way among other things. I'm curious what's recommended for cases like this.folder. Thepants-plugins
folder helps isolate plugins from regular code, which is necessary due to how Pants's startup sequence workspants-plugins
hundreds-father-404
03/14/2022, 10:14 PM--pantsd-invalidation-globs
properly? pantsbuild/pants is basically one big plugin running on itself 😛witty-crayon-22786
03/14/2022, 10:16 PMwitty-crayon-22786
03/14/2022, 10:19 PMpantsd
will restart when anything on the pythonpath changes (unless, as Eric said, you exclude items).high-yak-85899
03/14/2022, 10:42 PMpants-plugin
? Does that sound right?hundreds-father-404
03/14/2022, 10:44 PMrm -rf .pids
, or updating pantsd_invalidation_globs
or updatingThere, the only downside is that restarting pantsd means you have to redo some work you already had done. It's not a correctness issue, only suboptimal for perf, but it's not the end of the worldpantsd_invalidation_globs
witty-crayon-22786
03/14/2022, 10:45 PMso when you are iterating on your non-plugin-code that is used by your plugin code, you might be confused why changes aren’t happening.that can’t happen: if the code is loadable, it’s because it’s on the pythonpath. and the entire pythonpath is invalidated
witty-crayon-22786
03/14/2022, 10:46 PMpantsd_invalidation_globs
. that can cause an edit to not restart the server, but that’s opt in.witty-crayon-22786
03/14/2022, 10:51 PMsrc/python
on the pythonpath, which contains a lot of stuff unrelated to your plugin, pantsd
will restart more than you would like: things will be correct, but slower for your users.
you can reduce that by excluding things from invalidation (that you know are on the pythonpath, but not relevant to your plugin) via pantsd_invalidation_globs
… e.g. !/src/python/this/is/not/relevant
… but that needs to be done carefully/accurately, or pants
won’t restart for the plugin change.high-yak-85899
03/14/2022, 10:54 PMgenrule
in a way that lets us throw the generated code right back into the repo.high-yak-85899
03/14/2022, 10:57 PMwitty-crayon-22786
03/14/2022, 10:57 PMgenrule
in Pants is https://www.pantsbuild.org/v2.11/docs/reference-experimental_shell_command, but it’s fairly new. more docs here: https://www.pantsbuild.org/v2.11/docs/run-shell-commandswitty-crayon-22786
03/14/2022, 10:58 PMgenrule
doesn’t actually allow for mutating the repo, does it? … except maybe by violating the sandbox?witty-crayon-22786
03/14/2022, 10:59 PMexperimental_shell_command
:
The command is limited to operating on the specific set of input files provided as dependencies, and only produces output files for other targets to consume. It is not possible to mutate any file in the workspace.
high-yak-85899
03/14/2022, 11:01 PMlocation
which I assume gives us an absolute path which does violate the sandbox to put things back in the repo structure.high-yak-85899
03/14/2022, 11:11 PM