Hi! In which cases do we need to add `@resolve=......
# general
a
Hi! In which cases do we need to add
@resolve=...
?
w
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
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
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
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
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
doesn't have a resolve
— isn’t it defaulted to the default resolve of the repo?
I’m on 2.12
👍 1
w
@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
might be best if you take a look, I’ll send you the branch and error message in the cb slack