cold-soccer-63228
05/23/2022, 4:38 PMAllTargets
and AllTargetsRequest
exist, and also saw that in the Python backend, there was PythonSourceTarget
. Was wondering if there was a way to make a request to get all Python targets with some suffixbitter-ability-32190
05/23/2022, 4:40 PMPathGlobs
perhaps?fast-nail-55400
05/23/2022, 4:40 PMMySuffixPythonTargets
type. It would take AllPythonTargets
as a parameter.cold-soccer-63228
05/23/2022, 4:40 PMAllTargetsRequest
?
Something like the following with some other arguments?
await Get(AllTargets, AllTargetsRequest(PathGlobs("*_some_suffxi.py"), ...)
fast-nail-55400
05/23/2022, 4:41 PMAllPythonTargets.first_party
to file targets with .is_file_target
and with the desired suffix by checking the tgt.address
attribute.bitter-ability-32190
05/23/2022, 4:41 PMPathGLobs
likely isn't your pathbitter-ability-32190
05/23/2022, 4:42 PMhundreds-father-404
05/23/2022, 4:54 PMis_file_targetThat won't handle if you manually declared
PythonSourceTarget
What you want is something like:
https://github.com/pantsbuild/pants/blob/3ef6f122e35230f52631368cdbb3468f798ade97/src/python/pants/backend/python/dependency_inference/module_mapper.py#L67-L82
Check if target.has_field(PythonSourceField) and PurePath(target[PythonSourceField].file_path).name == "_some_suffix.py"
hundreds-father-404
05/23/2022, 4:55 PMTarget
and its fields