We have a _ton_ of util.py files (shocker) across ...
# general
f
We have a ton of util.py files (shocker) across our monorepo. Is there any way to coerce the python dependency inference to always prioritize the local folder's copy instead of warning? n/m fixed it (see thread)
Copy code
16:08:26.39 [WARN] The target foo/bar.py imports `util`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['foo/util.py', 'baz/util.py', 'qux/util.py', 'quux/util.py', 'corge/util.py', 'grault/util.py', 'garply/util.py', 'waldo/util.py', 'fred/util.py', 'plugh/util.py', 'xyzzy/util.py'].
Oh hold on, I just found
PANTS_PYTHON_INFER_AMBIGUITY_RESOLUTION
Cool that fixed it
e
Just a thought, but that probably shouldn't be an issue? Normally, when you have
foo/bar.py
what are you trying to import? I would expect you should have
import foo.util
or `import baz.util`so that there is no ambiguity anyways
f
It's a pretty common pattern in our code base to just do
import util
and expect to pick it up from the local folder.
Not saying it's right or good practice ... but common 🙂
e
Fair enough 🙂