lively-dusk-46231
10/22/2022, 8:40 AMprojects/
my_api
my_api
web
schema
service
my_api_test
setup.py
... 2 others
libs/
... 5 common libraries which are used across the projects
And when I run ./pants tailor
it seems to be creating a BUILD file for every single folder (100+) in my_api
, my_api.web
, my_api.schema
, my_api_test
, etc.
Is that expected ? I was thinking I just needed 5 (libs) + 3 (projects) BUILD files[source]
marker_filenames = ["setup.py"]
high-magician-46188
10/22/2022, 9:05 AMtailor
produces a good result, and in others a lesser one.
I’ve described the solution for my use-case here: https://pantsbuild.slack.com/archives/C046T6T9U/p1666426822534479?thread_ts=1664982667.688279&cid=C046T6T9U.
For your case, I imagine that the bast case would be to delete this BUILD
files you think are unimportant, review those who left.
I also think that it depends on the progress you have on the adoption ladder. That is, if you only want pants to produce Wheels for now and defer the whole Pex story for later, then a single BUILD file per package should be enough (and maybe another global one at the root).
Please note that I’m myself not too knowledgable on the matter and that the core team might be able to help you use tailor correctly.lively-dusk-46231
10/22/2022, 9:21 AMpants tailor
has created the "recommended" way to generate this.
But I now realize it is not the smartest and I can use my code understanding to make this simpler
Thanks! Let me try that out.pants
so I am not looking to move from whl -> pex and so on. Just trying to understand if I can install/lint/format/test/run with pants and what benefits it givessetup.py
, setup.cfg
, pyproject.toml
(and other black, isort configs etc)
And be providing them in the BUILD
file ?
Cause all these files seem to be capturing metadata/configs about my codehigh-magician-46188
10/22/2022, 9:26 AMpyproject.toml
should be kept as-is.
2. The setup.py
could be ignored by adding generate_setup_default = true
under the [setup-py-generation]
in the pants.toml
file.
3. I’m not sure about the setup.cfg
, as I’ve never used it (we didn’t had it at all in the first place).happy-kitchen-89482
10/22/2022, 1:11 PMoverrides
, that allow you to set metadata on only specific files owned by a BUILD file target (see https://www.pantsbuild.org/docs/targets#target-generation). So there is less reason to have all those BUILD files, and it may make sense to have just a few high-up ones, at least at first, whose sources glob over everything underneath them (the default sources=
only glob over files in the same dir).sources=['**/*.py', '!**/*_test.py']
, see https://www.pantsbuild.org/docs/targets#source-and-sources-field)sources=
can be simplerbitter-ability-32190
10/22/2022, 1:14 PMdependencies
field is difficult and unintuitive when you do the "big glob" approach.
A while back I think we agreed on wanting to address that, but haven't yetlively-dusk-46231
10/22/2022, 1:31 PMpants tailor --tailor-check
should run in my CI. So I assumed that what tailor is doing is the thing I should be following and even keep a CI check forbitter-ability-32190
10/22/2022, 1:34 PMlively-dusk-46231
10/22/2022, 1:40 PMsources=['***/*.py']
Then tailor will not try to auto generate build files for lower level folders :)
That is very helpful and makes sense
So now with my manually crafted BUILD files I can enable tailor in CI without any issue