Do we currently have any mechanism to run a `pants...
# development
w
Do we currently have any mechanism to run a
pants
-adjacent command? As in, I have a command I want to bundle inside of pants, but without running all the pants machinery?
p
I wrote a plugin that does something vaguely similar, though it still uses the pants machinery as a pass through to the
invoke
app. https://github.com/st2sandbox/st2/tree/pants/pants-plugins%2Fdo_invoke
w
How does it work - if it’s a plugin? As in, Pants all still has to start up and whatnot, and then invoke is available?
p
I haven't touched it in years, so I just re-read the code to refresh myself.
invoke
is a python app, not a binary. So, it requires adding the requirement to the list of plugins to make pants install it during bootstrapping. Note that I wrote this before plugins could provide a
requirements.txt
so it could be simplified now. Then, it uses a goal rule to run a little wrapper script that runs
invoke
from the pants venv and pass all arguments to it.
So it uses pants as little as possible, but just enough to handle distribution/bootstrapping of the binary app.
Oh. I forgot, there's a wrapper script (around the wrapper script created in the plugin) that allows bypassing pants entirely, it only uses pants to bootstrap if the wrapper script in
.pants.d
is missing. https://github.com/st2sandbox/st2/blob/pants/invoke
w
Ahh, okay, yeah, that makes more sense