<#20700 Allow plugin authors to attach custom fiel...
# github-notifications
c
#20700 Allow plugin authors to attach custom fields to `TargetData` for `pants peek` Issue created by ndellosa95 Is your feature request related to a problem? Please describe. We use
pants peek
to print metadata about that feeds into different processes in our CI. It seems silly to create a custom command to do basically the same thing when
peek
is already there. You can sort of already do this with custom target types if you use a
TargetGenerator
, but not with
TargetFilesGenerator
. Describe the solution you'd like Create a new union-type
TargetDataAdditionalInfoFieldSet
and an abstract
TargetDataAdditionalInfo
frozen dataclass with a
ClassVar[str]
attribute
label
. Add an attribute of type
Tuple[TargetDataAdditionalInfo, ...]
to TargetData in a field called
additional_info
. Plugin authors can provide union rules to return custom
TargetDataAdditionalInfo
class instances for additional info. The output will be formatted as such:
Copy code
{
    ...
    "additional_info": {
        "label1": ...
        "label2": ...
    }
    ...
}
pantsbuild/pants