https://pantsbuild.org/ logo
p

proud-dentist-22844

07/22/2021, 4:08 PM
I wonder if we could have a
disambiguate
target. If there are multiple source roots that each contain a
tests.fixtures
package, for example, maybe we could do something like
disambiguate(packages={"tests.fixtures": "./fixtures/"})
. Or even, add another arg to
python_library
like
python_library(disambiguate={"tests.fixtures": "./fixtures/"})
so that anything in that target that imports something from
tests.fixtures
would use the
./fixtures/
as the dependency. And any files that do not depend on
tests.fixtures
would not get a hard-coded dependency on it (as with
python_library(dependencies=…)
). Basically, an extra knob to tune dependency inference without requiring hard-coded dependencies.
h

hundreds-father-404

07/22/2021, 6:55 PM
Would targets in the directory subtree automatically pick up that disambiguation based on their file paths being in the subtree? Or they explicitly opt into it?
(Thanks for sharing this suggestion! Really helpful to know where the pain points are and I appreciate you thinking of ways to fix it)
p

proud-dentist-22844

07/22/2021, 9:48 PM
If
disambiguate
is a target, then I would hope that it would apply to at least all of the targets in the current BUILD file. Bonus points if there's a way to apply that to sub directories as well.
If
disambiguate
is only an extra arg on
python_library
or
python_test
and friends, then I would expect to define it on every instance of
python_library
or
python_test
(like
dependencies
)
5 Views