witty-crayon-22786
01/23/2020, 11:11 PMwitty-crayon-22786
01/23/2020, 11:12 PM--owner-of
is popular, for good reason... it allows for the kind of syntax you're proposingwitty-crayon-22786
01/23/2020, 11:13 PMwitty-crayon-22786
01/23/2020, 11:13 PMwitty-crayon-22786
01/23/2020, 11:14 PMwitty-crayon-22786
01/23/2020, 11:15 PMwitty-crayon-22786
01/23/2020, 11:15 PMhappy-kitchen-89482
01/23/2020, 11:31 PM--owner-of
implies that you're thinking in the world of targets, and filesystem specs imply that you're thinking in the world of files.happy-kitchen-89482
01/23/2020, 11:32 PMhundreds-father-404
01/23/2020, 11:33 PMFilesystemSpec
, FilesystemSpecs
, and Specs
, then updating all the call sites to use the new names + updating cmd_line_spec_parser.py
to resolve between the two types of specs. We need those changes no matter what
Also, we can always decide to deprecate --owner-of
in a followup that backports fs specs. While this PR adds messages saying fs specs don’t work with V1, those messages may be easily removed just as easily as they were added.
I’m hoping to land the PR independent of the --owner-of
discussion so that it’s easier to work on followup PRs, like getting FS specs to emulate --owner-of
. Right now, FS specs only work with the toy examples of validate
and cloc
. But, this PR lays the foundation to do more powerful thingshappy-kitchen-89482
01/23/2020, 11:34 PM--owner-of
continues to work as usual, so this change only affects v2 users, and so seems like something we can continue to debate?witty-crayon-22786
01/23/2020, 11:34 PMcloc
and validate
. i do not think it is worth biasing toward.happy-kitchen-89482
01/23/2020, 11:34 PMhappy-kitchen-89482
01/23/2020, 11:35 PMwitty-crayon-22786
01/23/2020, 11:36 PMbuildgen
is important as well, but you have yourself pointed out that targets should be secondary: so contorting to support a goal that shouldn't be necessary to run manually (because dep inference) isn't greathappy-kitchen-89482
01/23/2020, 11:36 PMcloc
and validate
happen to not require targets at all in order to function, but there is a significant difference between "targets as background config" and "targets as the unit of CLI interaction"happy-kitchen-89482
01/23/2020, 11:36 PM./pants test path/to/file_test.py
is very naturalwitty-crayon-22786
01/23/2020, 11:37 PMwitty-crayon-22786
01/23/2020, 11:37 PMwitty-crayon-22786
01/23/2020, 11:37 PMhappy-kitchen-89482
01/23/2020, 11:37 PMwitty-crayon-22786
01/23/2020, 11:37 PMwitty-crayon-22786
01/23/2020, 11:38 PMhappy-kitchen-89482
01/23/2020, 11:38 PMwitty-crayon-22786
01/23/2020, 11:38 PM--owner-of
and FilesystemSpecs are intimately relatedhappy-kitchen-89482
01/23/2020, 11:38 PMwitty-crayon-22786
01/23/2020, 11:38 PMhappy-kitchen-89482
01/23/2020, 11:39 PM--owner-of
says "there is this thing called a target, that is the unit of CLI interaction, we happen to have a way of mapping files back to targets, but your operations are happening at the target level", whereas filesystem specs say "operations happen at the file level, they may get some config from these things called targets"happy-kitchen-89482
01/23/2020, 11:39 PMwitty-crayon-22786
01/23/2020, 11:40 PM--owner-of
. if they don't, then we are asking for confusion and pain.witty-crayon-22786
01/23/2020, 11:40 PMhappy-kitchen-89482
01/23/2020, 11:40 PMhappy-kitchen-89482
01/23/2020, 11:40 PM--owner-of
is not thatwitty-crayon-22786
01/23/2020, 11:40 PMhappy-kitchen-89482
01/23/2020, 11:41 PMwitty-crayon-22786
01/23/2020, 11:41 PMwitty-crayon-22786
01/23/2020, 11:41 PMhappy-kitchen-89482
01/23/2020, 11:41 PMwitty-crayon-22786
01/23/2020, 11:41 PMwitty-crayon-22786
01/23/2020, 11:41 PMhappy-kitchen-89482
01/23/2020, 11:42 PMhappy-kitchen-89482
01/23/2020, 11:42 PMwitty-crayon-22786
01/23/2020, 11:42 PMwitty-crayon-22786
01/23/2020, 11:42 PMwitty-crayon-22786
01/23/2020, 11:43 PMwitty-crayon-22786
01/23/2020, 11:43 PMwitty-crayon-22786
01/23/2020, 11:44 PMwitty-crayon-22786
01/23/2020, 11:45 PMwitty-crayon-22786
01/23/2020, 11:45 PMwitty-crayon-22786
01/23/2020, 11:45 PMhappy-kitchen-89482
01/23/2020, 11:46 PMhappy-kitchen-89482
01/23/2020, 11:46 PMwitty-crayon-22786
01/23/2020, 11:46 PMwitty-crayon-22786
01/23/2020, 11:47 PMwitty-crayon-22786
01/23/2020, 11:47 PMhundreds-father-404
01/23/2020, 11:47 PMin those cases, you would blow up on the command line: “sorry, you gave me a file! i only understand targets”In this case, the fs spec would act like
--owner-of
and map back to the targethappy-kitchen-89482
01/23/2020, 11:48 PMwitty-crayon-22786
01/23/2020, 11:48 PM./pants publish path/to/some/file.py
# "Exception: this is a goal that can only understand targets"happy-kitchen-89482
01/23/2020, 11:48 PMwitty-crayon-22786
01/23/2020, 11:48 PMhappy-kitchen-89482
01/23/2020, 11:48 PMwitty-crayon-22786
01/23/2020, 11:49 PMwitty-crayon-22786
01/23/2020, 11:49 PMwitty-crayon-22786
01/23/2020, 11:49 PMhappy-kitchen-89482
01/23/2020, 11:49 PM./pants binary path/to/file_with_an_entrypoint.py
is pretty unambiguoushappy-kitchen-89482
01/23/2020, 11:50 PMpython_binary
target for it at all.witty-crayon-22786
01/23/2020, 11:50 PMhappy-kitchen-89482
01/23/2020, 11:50 PMpython_library
happy-kitchen-89482
01/23/2020, 11:50 PMwitty-crayon-22786
01/23/2020, 11:52 PMhappy-kitchen-89482
01/23/2020, 11:52 PM--owner-of
in favor of filesystem specs if there's a way to do that neatly in v1 (and it sounds like you're saying there is), but there will still be a discontinuity between how that behaves in v1 and v2, or at least how I'm envisioning v2 working... 🙂witty-crayon-22786
01/23/2020, 11:52 PMwitty-crayon-22786
01/23/2020, 11:52 PMhappy-kitchen-89482
01/23/2020, 11:53 PMhappy-kitchen-89482
01/23/2020, 11:54 PMwitty-crayon-22786
01/23/2020, 11:54 PMwitty-crayon-22786
01/23/2020, 11:54 PM--owner-of
.happy-kitchen-89482
01/23/2020, 11:55 PMhappy-kitchen-89482
01/23/2020, 11:55 PMwitty-crayon-22786
01/23/2020, 11:55 PMhappy-kitchen-89482
01/23/2020, 11:56 PMhappy-kitchen-89482
01/23/2020, 11:56 PMwitty-crayon-22786
01/23/2020, 11:56 PMbinary $file
case if there was a target owning the file?witty-crayon-22786
01/23/2020, 11:57 PMhappy-kitchen-89482
01/23/2020, 11:57 PMhappy-kitchen-89482
01/23/2020, 11:57 PMwitty-crayon-22786
01/23/2020, 11:57 PM--owner-of
then.witty-crayon-22786
01/23/2020, 11:58 PM--owner-of
plus dependency inference.happy-kitchen-89482
01/23/2020, 11:58 PM--owner-of
requires a target to exist, no?witty-crayon-22786
01/23/2020, 11:58 PMwitty-crayon-22786
01/23/2020, 11:58 PMwitty-crayon-22786
01/23/2020, 11:59 PMwitty-crayon-22786
01/23/2020, 11:59 PMhappy-kitchen-89482
01/24/2020, 12:00 AMhappy-kitchen-89482
01/24/2020, 12:00 AMhappy-kitchen-89482
01/24/2020, 12:00 AMhappy-kitchen-89482
01/24/2020, 12:00 AMbinary
is not the best example to usewitty-crayon-22786
01/24/2020, 12:01 AMbinary $file
, you really have to attempt to find the owning target on disk firstwitty-crayon-22786
01/24/2020, 12:02 AMwitty-crayon-22786
01/24/2020, 12:03 AMvalidate
, buildgen
, cloc
: they should be the special cases (in my mind) that don't even ask for addresses, and just directly consume filespecshappy-kitchen-89482
01/24/2020, 12:04 AMpython_library
? All the useful config is on that library target, and the user is directly providing the entrypoint, which is usually the only salient thing a python_binary
provides that a python_library
does not. So a python_binary
need not exist at all, not even by inference.witty-crayon-22786
01/24/2020, 12:04 AMhappy-kitchen-89482
01/24/2020, 12:05 AMhundreds-father-404
01/24/2020, 12:05 AMfinally: about validate , buildgen , cloc : they should be the special cases (in my mind) that don’t even ask for addresses, and just directly consume filespecsFtr, that’s what I’m proposing in the design doc. I could see us eventually going to this future where targets don’t exist and/or are much less relevant, but for now every goal but
validate
, buildgen
, and cloc
needs to map back to an owning target.
The edge case is goals that should map back to owning targets + preserve the files specified to be more precise in how they operate, like test
and lint
. This is handled by the TargetWithSources
type in the proposalwitty-crayon-22786
01/24/2020, 12:05 AMpython_tests
config if i type ./pants test $file
witty-crayon-22786
01/24/2020, 12:06 AMhappy-kitchen-89482
01/24/2020, 12:06 AMwitty-crayon-22786
01/24/2020, 12:06 AMwitty-crayon-22786
01/24/2020, 12:06 AMhundreds-father-404
01/24/2020, 12:09 AMif that’s the case, then deprecating owner-of should be straightforward.if we were okay with
./pants test foo.py
meaning in V2 to try to only run over foo.py
(but still grabbing metadata from the owning target), whereas in V1 it always no matter what means the owning target. I find the difference in those semantics very confusing, personally, but am willing to trust others’ judgment on this
(Originally, the other edge case I was concerned about is that there’s no way to port SourcesSnapshot
, i.e. get V1 goals to work on files that have no owners. I realized that’s irrelevant. Only cloc
, validate
, and buildgen
behave this way, and they already are implemented in V2)witty-crayon-22786
01/24/2020, 12:10 AMbut still grabbing metadata from the owning targeti think that you have to. see two or three above.
witty-crayon-22786
01/24/2020, 12:10 AMhappy-kitchen-89482
01/24/2020, 12:10 AM./pants test path/to/foo_test.py
will run just the tests in that file in v2, but all the tests in that file's owning target in v1. So it sounds like you're comfortable with those differences?witty-crayon-22786
01/24/2020, 12:10 AM--owner-of
is not v1 only, it works with both v1 and v2witty-crayon-22786
01/24/2020, 12:11 AMwitty-crayon-22786
01/24/2020, 12:11 AMSo it sounds like you're comfortable with those differences?yes.
hundreds-father-404
01/24/2020, 12:11 AM> but still grabbing metadata from the owning target
i think that you have to. see two or three above.Right. I’m not debating resolving the owning target at all. The conversation took a turn towards that for a bit, but I view that part of the conservation as “this might be a possible future where we aren’t as wedded to targets.” For now, I think that’s the wrong discussion
witty-crayon-22786
01/24/2020, 12:12 AMwitty-crayon-22786
01/24/2020, 12:13 AMhappy-kitchen-89482
01/24/2020, 12:13 AMhappy-kitchen-89482
01/24/2020, 12:13 AMwitty-crayon-22786
01/24/2020, 12:13 AM--owner-of
with this mechanism.hundreds-father-404
01/24/2020, 12:15 AM> So it sounds like you’re comfortable with those differences?
yes.This is the heart of the disagreement in my eyes, then. If we were okay with the different semantics between V1 vs. V2 goals—where V2 implementations were more powerful to attempt to only operate on the specified files whereas V1 is more imprecise and operates over teh whole owning target—then, yes, I agree with deprecating
--owner-of
happy-kitchen-89482
01/24/2020, 12:15 AM--owner-of
)witty-crayon-22786
01/24/2020, 12:15 AMhappy-kitchen-89482
01/24/2020, 12:15 AMhappy-kitchen-89482
01/24/2020, 12:16 AMhappy-kitchen-89482
01/24/2020, 12:16 AMwitty-crayon-22786
01/24/2020, 12:16 AM./pants $goal $file
always attempting to actually find the owning target before it decides to generate one" bit is an important takeaway from this discussionhundreds-father-404
01/24/2020, 12:17 AM./pants fmt2 foo.py
works but ./pants fmt foo.py
fails.
I think you’re right, Stu, that that confusion is even worse than the confusion of why ./pants fmt2 foo.py
only runs on foo.py
whereas ./pants fmt foo.py
runs over the whole targethundreds-father-404
01/24/2020, 12:17 AMalways attempting to actually find the owning target before it decides to generate one” bit is an important takeaway from this discussion*For any goal which does not request
SourcesSnapshot
/ needs target infowitty-crayon-22786
01/24/2020, 12:18 AM*For any goal which does not requestwhich isSourcesSnapshot
cloc
/ buildgen
/ validate
, right?witty-crayon-22786
01/24/2020, 12:18 AMSourcesSnapshot
happy-kitchen-89482
01/24/2020, 12:18 AMwitty-crayon-22786
01/24/2020, 12:18 AMhundreds-father-404
01/24/2020, 12:18 AMAs long as there is a sensible way to implement filesystem specs for v1, which it sounds like there is. That part I have not looked into at all.Yep. My next task was getting fs specs to work like
--owner-of
happy-kitchen-89482
01/24/2020, 12:19 AMwitty-crayon-22786
01/24/2020, 12:19 AMwitty-crayon-22786
01/24/2020, 12:20 AMhundreds-father-404
01/24/2020, 12:20 AMcloc2
and validate
We’d remove those error messages as soon as that lands. But, for now, the error message is technically correcthappy-kitchen-89482
01/24/2020, 12:21 AMwitty-crayon-22786
01/24/2020, 12:21 AMwitty-crayon-22786
01/24/2020, 12:22 AMhundreds-father-404
01/24/2020, 12:22 AM--owner-of
. Will put up the RunTracker change in a second toowitty-crayon-22786
01/24/2020, 12:24 AMwitty-crayon-22786
01/24/2020, 12:38 AMwitty-crayon-22786
01/24/2020, 12:38 AM