https://pantsbuild.org/ logo
#general
Title
# general
f

full-toothbrush-75676

09/27/2021, 7:17 PM
Hi pants! What’s the recommended way to install a 1st-party CLI tool from source in “editable” mode using
pants
? This would be helpful to use while developing the tool so changes to source are reflected when using the CLI tool without having to uninstall / reinstall. From reading the
pants
docs, it seems like using a
python_distribution
with
entry_points
might be my best bet for installing said CLI tool, but I’m not finding if there is a way to install this distribution in “editable” mode. Let me know if I’m on the wrong track, too…
Hmm thinking about this a bit more – would this even be possible in a monorepo using
pants
? B/c pants does some magic to pull in other 1st-party dependencies, it’s probably not nearly as straightforward as the dynamic linking that
setuptools
does with
python setup.py develop
– is my understanding correct here?
w

witty-crayon-22786

09/27/2021, 7:33 PM
generally to iterate on a 1st party tool, you’d define a
pex_binary
for it, and then
./pants run
or
./pants package
it
which would use the latest sources at each invoke
f

full-toothbrush-75676

09/27/2021, 7:46 PM
Ahh I totally missed
./pants run
– thanks, that should do it!
w

witty-crayon-22786

09/27/2021, 9:46 PM
sure thing! depending on whether your package does something sideeffecty (triggering the nukes / gender reveal, etc), you might also be able to use
./pants --loop run
to re-run it continuously as files change
👍 1
(although
--loop
won’t kill the process if it is long-lived, so not useful in all cases: see #9462)
3 Views