<#20595 `__defaults__` should apply also for gener...
# github-notifications
c
#20595 `__defaults__` should apply also for generated targets Issue created by kaos Describe the bug
Copy code
# 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/pants