hundreds-father-404
03/17/2022, 6:20 PMdependencies
field is a misnomer: it doesn't allow you to intuit dependency inference & how the field augments what gets inferred.
Instead, I'm proposing renaming the field to extra_deps
explicit_deps
. That will hopefully prompt you to ask yourself "What are the not-explicit deps?"
Changing this is is 100% automated for users by running ./pants update-build-files
. We can easily have a long deprecation cycle, it's literally only 2 lines of code to support the old name.
But ack that this does cause some churn, even though it's automated, like a bigger Git diff when upgrading.witty-crayon-22786
03/17/2022, 6:34 PMhundreds-father-404
03/17/2022, 6:35 PMhundreds-father-404
03/17/2022, 6:37 PMwitty-crayon-22786
03/17/2022, 6:39 PMextra_deps
if dependency inference was turned off, or not implemented for a languagehundreds-father-404
03/17/2022, 6:40 PMor not implemented for a languageTom made a good point in the new-language guide that dependency inference is the bread and butter of Pants, he recommended it being one of the first things to implement Also, the Target API lets plugin authors rename the field if they want, e.g. when adding a new language.
bitter-ability-32190
03/17/2022, 6:48 PMdependencies
is verbose (although a very weak argument)
• Setting dependencies
feels weird because I feel like I'm setting dependencies (not adding additional ones). E.g. it's not clear we're not setting and really we're merging
• I'd be surprised if dep inference was off. That's like the #1 feature of Pants IMO.
• I don't love extra_deps
because it kind of sounds like optional deps, but I like that it's short and isn't `deps`/`dependencies`. I'm happy with an equivalenthundreds-father-404
03/17/2022, 6:49 PMexplicit_deps
, additional_deps
flat-zoo-31952
03/17/2022, 6:58 PMexplicit_deps
works in both senses thoughhundreds-father-404
03/17/2022, 7:00 PMexplicit_deps
. I don't love that explicit
is harder to type than extra
, but clarity is maybe worth itflat-zoo-31952
03/17/2022, 7:00 PMdependencies
overrode all inferenceflat-zoo-31952
03/17/2022, 7:01 PMbitter-ability-32190
03/17/2022, 7:01 PMdeps.add
or deps
would be so perfecthundreds-father-404
03/17/2022, 7:01 PMdependencies
made a lot of sense: that's all there was.
Since Pants 2.0, it has always augmented inferred depsflat-zoo-31952
03/17/2022, 7:01 PMhundreds-father-404
03/17/2022, 7:03 PMdependencies=["foo"]
would be augmenting something. Unless you already know Pants has dependency inference & has this behavior, why the heck would you ever intuit something like that?hundreds-father-404
03/17/2022, 7:03 PMbitter-ability-32190
03/17/2022, 7:05 PMdeps
-> Sets the value and completely overrides
deps_add
-> Adds the deps
deps_remove
-> Removes inferred depsbusy-vase-39202
03/17/2022, 7:06 PMhundreds-father-404
03/17/2022, 7:06 PMHave we had reports of it being commonly used for any other reason?I think mostly only people migrating from v1 to v2 and wanting to minimize change. @flat-zoo-31952 you used to not use dep inference, right? But changed your mind?
hundreds-father-404
03/17/2022, 7:08 PMMaybe more confusing but maybe not.I think possibly confusing to users, and particularly hard to implement with the Target API. It's very field-centric whereby one field has all you need; spreading out one concept into 3 different highly related fields is not well supported. Also I can't imagine when you'd want to completely override? Seems like usually it'd only be 1-2 false positives you want to remove
flat-zoo-31952
03/17/2022, 7:08 PMflat-zoo-31952
03/17/2022, 7:10 PM'!//::'
rule would work, right? Idk if you can use that "all targets recursively" syntax there thoughbitter-ability-32190
03/17/2022, 7:10 PMAlso I can't imagine when you'd want to completely override? Seems like usually it'd only be 1-2 false positives you want to removeActually this is something we haven't discussed. Adding
"!..."
strings to explicit_deps
seems weird 😐hundreds-father-404
03/17/2022, 7:11 PMI'd say for "turn it off here" a '!//::'yeah we could do something like that if the need ever arose; no need for a new field
flat-zoo-31952
03/17/2022, 7:11 PMAddingWhy? It's saying "explicitly not this"strings to"!..."
seems weird 😐explicit_deps
flat-zoo-31952
03/17/2022, 7:17 PMbusy-vase-39202
03/17/2022, 7:22 PMhundreds-father-404
03/17/2022, 7:26 PMbusy-vase-39202
03/17/2022, 7:27 PMflat-zoo-31952
03/17/2022, 7:28 PMbitter-ability-32190
03/17/2022, 7:29 PMbusy-vase-39202
03/17/2022, 7:31 PMbusy-vase-39202
03/17/2022, 7:32 PMhundreds-father-404
03/17/2022, 7:33 PMupdate-build-files
busy-vase-39202
03/17/2022, 7:34 PMcurved-television-6568
03/17/2022, 7:53 PMcurved-television-6568
03/17/2022, 7:57 PMdependencies
field; but I haven't had to explain what it does to anyone either..)flat-zoo-31952
03/17/2022, 8:00 PMAlso consider output like that from peek, where the inferred deps also are present..This is a good point too. But peek shows some things that are "computed" fields as well, like "address" and "target_type". Dependencies could be included in that
hundreds-father-404
03/17/2022, 8:04 PMpeek
currently shows dependencies
vs dependencies_raw
, which is the actual field. So it would become dependencies
(everything) & explicit_dependencies