freezing-vegetable-92896
12/02/2021, 7:33 PMpants tailor
isn’t generating some build files I would have expected it to (there are .py
files in the directory). Is there a readable explanation of the logic of how tailor decides where a BUILD
file is needed that someone can point me at?hundreds-father-404
12/02/2021, 7:36 PM./pants list path/to/file.py
return anything? It's possible the file is already "owned" thanks to recursive sources
This is how Pants determines which Python targets it might want to create: https://github.com/pantsbuild/pants/blob/8d1c4c4fc68295b5bd394108c441ea8ced0bc1ee/src/python/pants/backend/python/goals/tailor.py#L95-L121
And then core/goals/tailor.py
will filter out any targets that cover files already "owned"freezing-vegetable-92896
12/02/2021, 7:39 PM__init__.py
file.
./pants list foo/__init__.py
errors, but ./pants tailor
will not create a BUILD file or target for the filefreezing-vegetable-92896
12/02/2021, 7:40 PM__init__.py
.hundreds-father-404
12/02/2021, 7:40 PM[python].tailor_ignore_solitary_init_files = false
freezing-vegetable-92896
12/02/2021, 7:41 PMfreezing-vegetable-92896
12/02/2021, 7:44 PM__init__.py
file (that does contain code) plus several other modules (but no python files) that is not picking up a BUILD
filehundreds-father-404
12/02/2021, 7:45 PM.gitignore
by chance? https://www.pantsbuild.org/docs/troubleshooting#pants-cannot-find-a-file-in-your-project
Try running ./pants count-loc path/to/file.py
to debugfreezing-vegetable-92896
12/02/2021, 7:49 PMhundreds-father-404
12/02/2021, 7:49 PMcount-loc
works regardless of targets. But ./pants list path/to/file.py
will tell you if it's already owned or notwitty-crayon-22786
12/02/2021, 7:51 PM./pants dependees $file
to see the target that owns ithundreds-father-404
12/02/2021, 7:52 PM./pants list $file
is an easier way to do thatfreezing-vegetable-92896
12/02/2021, 7:52 PM**
a couple of directories upfreezing-vegetable-92896
12/02/2021, 7:53 PM**
glob for one of our packaging targets, but I don’t want it to stop generation of other BUILD files (or more crucially stop pants tailor from telling us if some of them are missing)hundreds-father-404
12/02/2021, 7:53 PMhundreds-father-404
12/02/2021, 7:54 PM**
? If you haven't read this page of the docs in the past two weeks, I encourage re-reading it. We rewrote it to better explain what Pants is doing with "target generation"freezing-vegetable-92896
12/02/2021, 7:54 PMfreezing-vegetable-92896
12/02/2021, 7:54 PMfreezing-vegetable-92896
12/02/2021, 7:55 PMfreezing-vegetable-92896
12/02/2021, 7:55 PMfreezing-vegetable-92896
12/02/2021, 7:57 PMhappy-kitchen-89482
12/02/2021, 8:01 PM