steep-eve-20716
08/14/2024, 10:05 PMimport sqlalchemy
, and pants printed the following warning, even though the first target in the array is a perfect match (same name, same resolve, and same source root).
14:33:11.60 [WARN] The target common/file.py imports `sqlalchemy`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['common:poetry#sqlalchemy', 'libs/libA:poetry#sqlalchemy-stubs@resolve=common', 'libs/libB:poetry#sqlalchemy-stubs@resolve=common'].
Right here, pants applies the by_source_root
logic against each category of dependencies separately. Since our common:poetry
doesn't declare a dependency on sqlalchemy-stubs
but files in other source roots in our repo do, pants thinks the dependency is ambiguous.
I don't know if this should be considered a bug? It sort of makes sense. But this isn't documented anywhere I could find, so it took a while to find the root cause.