https://pantsbuild.org/ logo
p

proud-dentist-22844

05/26/2022, 9:30 PM
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

high-yak-85899

05/26/2022, 9:30 PM
tailor
isn't configurable right now iirc Edit: in terms of how it adds targets I mean
w

witty-crayon-22786

05/26/2022, 9:31 PM
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

high-yak-85899

05/26/2022, 9:32 PM
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

proud-dentist-22844

05/26/2022, 9:32 PM
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

proud-dentist-22844

05/26/2022, 9:33 PM
Sadly, I can't delete until I've proven the method and we've transitioned the project over.
h

hundreds-father-404

05/26/2022, 9:33 PM
(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

proud-dentist-22844

05/26/2022, 9:33 PM
Oh dang! there are backend specific tailor options!
h

hundreds-father-404

05/26/2022, 9:34 PM
yeah, discovery isn't the best there. What would have helped here? The
help
message for
tailor
to mention this?
p

proud-dentist-22844

05/26/2022, 9:35 PM
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

hundreds-father-404

05/26/2022, 9:42 PM
5 Views