Hi Pants, I have a question about `./pants tailor`...
# general
a
Hi Pants, I have a question about
./pants tailor
. We want to use it to check whether we have all the BUILD files and targets we need, and found 2 problems: 1. it always generates a
BUILD
file at the repo root, which we actually don't want; and 2. it generates a bunch of
pex_binary
targets which we don't need either. What are the rules that make
tailor
generate those
pex_binary
targets?
e
h
You can also tell Pants to not generate for
pex_binary
with
[python].tailor_pex_binary_targets = false
(the subsystem is called
[python-setup]
in earlier Pants versions)
e
p
As to why pants tailor generates pex_binary targets for files, it is because it detects an entry point (
if __name__ == "__main__":
) in them. this is done here: https://github.com/pantsbuild/pants/blob/891adbbad5be7b5dc21b2be97206e0a4cbf2ead0/src/python/pants/backend/python/goals/tailor.py#L150
2
a
Gotcha, thanks a lot. So I think the answers are: 1. a BUILD file is generated at root because it detects a
.py
file there 2. pex binaries are generated because
main
are detected. And the solution to not have any unwanted updates is to configure the
tailor
section in the toml file, for each of the targets.