cool-easter-32542
02/23/2024, 7:47 AM# BUILD
__defaults__({python_source: dict(...)})
python_sources()
The python_sources target will generate a python_source target for each source file, but none of them will apply the specified default field values from the __defaults__ declaration. (This is why we see/suggest using patterns like __defaults__({(python_sources, python_source): ...}).)
Pants version
main
OS
Any
Additional info
This is due to the __defaults__ being applied to the TargetAdaptor during BUILD file parsing only, so the defaults in this case would have to target the python_sources generator, and not the generated targets to apply.
This is not very intuitive and should be fixed. One possible idea is to have pants provide the applicable defaults when calling the generator, and it will be up to the generator to apply those defaults to the targets it creates, as it deems fit.
pantsbuild/pantscool-easter-32542
03/18/2024, 3:18 PM