https://pantsbuild.org/ logo
a

ambitious-student-81104

07/13/2022, 8:17 PM
Hi! In which cases do we need to add
@resolve=...
?
w

witty-crayon-22786

07/13/2022, 8:32 PM
first of all: it should be fairly rare to need to add explicit dependencies.
as in, 1% of the time, or less
(if that’s not the case, that’s the first thing to look into)
a

ambitious-student-81104

07/13/2022, 8:35 PM
hmm OK. if I have an upstream dependency declared with
resolve=parametrize(a, b)
and the target that depends on it also has ``resolve=parametrize(a, b)` should Pants just be able to figure out who uses what?
w

witty-crayon-22786

07/13/2022, 8:35 PM
when you do need to add an explicit dependency, you should only need to append
@resolve=..
when 1. the dependency is `resolve=parametrize(..)`d 2. the dependee does not want to use their own resolve (since it will default to filling in the relevant resolve) or the dependee doesn’t have a resolve
if I have an upstream dependency declared with
resolve=parametrize(a, b)
and the target that depends on it also has ``resolve=parametrize(a, b)` should Pants just be able to figure out who uses what?
correct.
dependency inference will only look at other targets in the same resolve, and explicitly declared dependencies will automatically fill in
some/dependency.py
to
some/dependency.py@resolve=myresolve
if the dependee has a resolve
a

ambitious-student-81104

07/13/2022, 8:38 PM
what does this mean? you cannot reference a dependency in a different resolve anyway
the dependee does not want to use their own resolve (since it will default to filling in the relevant resolve)
w

witty-crayon-22786

07/13/2022, 8:38 PM
but make sure that you are on at least 2.12: the behavior didn’t change between 2.11 and 2.12, but the error messages got much better
@ambitious-student-81104: yea, good point. so only the latter part (“…_or_ the dependee doesn’t have a resolve”) is relevant.
a

ambitious-student-81104

07/13/2022, 8:40 PM
doesn't have a resolve
— isn’t it defaulted to the default resolve of the repo?
I’m on 2.12
👍 1
w

witty-crayon-22786

07/13/2022, 8:42 PM
@ambitious-student-81104: an example would be something like an
archive
target or a
python_distribution
maybe? i don’t have a good example
1
(can’t remember whether a
python_distribution
is a member of a resolve)
a

ambitious-student-81104

07/13/2022, 8:49 PM
might be best if you take a look, I’ll send you the branch and error message in the cb slack
7 Views