I finally took a stab at upgrading from pants 2.7 ...
# general
p
I finally took a stab at upgrading from pants 2.7 to 2.11 (via 2.8, 2.9, 2.10 as in the docs). tailor is recommending I add a whole bunch of
pex_binary
targets for files that have an
if __name__ = "__main__":
block. But in many cases, these are just poor-excuses for testing. Is there a way to tell tailor to not add any
pex_binary
targets? Or maybe I'm missing something - why should I let it add them?
2
h
tailor
isn't configurable right now iirc Edit: in terms of how it adds targets I mean
w
either
ignore_paths
or
ignore_adding_targets
: https://www.pantsbuild.org/docs/reference-tailor#section-ignore-paths
although really what this might call for is a combination of those two… “do not add this target type for this file”
h
We also had a bunch of legacy sections like that in our test code and I just deleted all the ones that weren't needed (e.g. because they were manual tests) 🤷
p
ignore_paths
would skip writing anything in one or more BUILD files, when I'm happy to get new python_* and shell_* targets added in those.
ignore_adding_targets
might work... hmm
p
Sadly, I can't delete until I've proven the method and we've transitioned the project over.
h
(and 2.12 added options like that to everywhere it was missing. So in 2.12 it's possible to disable tailor for everything, on a per-target basis)
p
Oh dang! there are backend specific tailor options!
h
yeah, discovery isn't the best there. What would have helped here? The
help
message for
tailor
to mention this?
p
I searched for
tailor
in the pants docs, and jumped to the tailor reference: https://www.pantsbuild.org/docs/reference-tailor
So a note in there to check out backend-specific options would be helpful.
👍 1
tailor_pex_binary_targets = false
is a beautiful thing!
That did exactly what I needed. 😄
❤️ 1
h