pants icon indicating copy to clipboard operation
pants copied to clipboard

Full support for target generators that create targets of multiple types

Open ndellosa95 opened this issue 8 months ago • 0 comments

Is your feature request related to a problem? Please describe. This is technically possible already in that Pants does not check that the targets you generate actually conform to the type specified as the generated_target_cls. It is even used here and a few other places to generate a _generator_sources_helper target. However, certain features such as __defaults__ and maybe parametrize are limited to a single target type based on the code here.

Describe the solution you'd like Fully supporting target generators generating multiple different target types that are defaults-compatible.

Describe alternatives you've considered One alternate solution that I'm not positive would work is using a base target generator to generate additional target generators that each generate targets of a single type. However, this feels like a hack given that multi-type target generators are already in use in pants core code.

Additional context This is part of the open-source pants dbt backend plugin I am creating. Originally I had separate target generators for each component of a dbt project (models, macros, tests, etc). However, given that dbt already enforces a project structure defined in its root project file dbt_project.yml I think an even better solution would be just to have a single dbt_project target generator that generates all of the targets downstream.

ndellosa95 avatar May 31 '24 14:05 ndellosa95