hundreds-father-404
09/15/2021, 3:02 AMpython_requirements
, poetry_requirements
), and unlocks new boilerplate reduction.
We need a syntax for how to address generated targets, e.g. in the dependencies
field. It needs to include the generating target's address so we know how to generate it.
The current proposal is dir:generator!generated
, e.g. //:reqs!Django
or src/py/project:lib!foo.py
. But, !
requires quotes to work in the terminal 𤷠The other alternatives to !
are =
and `@`:hundreds-father-404
09/15/2021, 3:03 AM//:reqs=Django
or //:reqs@Django
?
is an option but also requires quotes. And we could technically use :
again, but dir/generator:generated
is confusing
Do we stick with !
, use =
or @
, or some wildcard we're not considering? Thoughts appreciated!
See https://github.com/pantsbuild/pants/pull/12891 for the PRenough-analyst-54434
09/15/2021, 3:03 AMhundreds-father-404
09/15/2021, 3:06 AM./pants dependees //:reqs!Django
(a python_requirement_library
), so you can't use a file argument
2) You have >1 target owning a file, like two python_tests
targets called :tests_py2
and :tests_py3
that run the same tests but w/ different interpreters. You only want to run one - you need to use the addressbored-art-40741
09/15/2021, 3:07 AM#
or $
? !
definitely sounds dangerous given commandline issuesbored-art-40741
09/15/2021, 3:08 AM+
hundreds-father-404
09/15/2021, 3:11 AM#
and $
more than =
and @
! Thanks.
(We don't currently ban those when used in target names, so it's not technically safe to start using...but we could maybe retcon it with a good error message and communication to community.)enough-analyst-54434
09/15/2021, 3:12 AM//:Django
is what I know as a user IIUC and then //:Django@reqs
is what I need due to Pantsisms (do I really need it if there is just one applicable generator?hundreds-father-404
09/15/2021, 3:14 AMif there is just one applicable generator?That's going to be rare if https://docs.google.com/document/d/1HpJn2jTWf5sKob6zhe4SqHZ7KWBlX4a6OJOwnuw-IHo/edit# is accepted. Anytime you have
python_tests
or python_library
, that's a generator. And it's possible to generate in a subdirectory, so we would have to look up the whole source tree for candidate generatorsproud-dentist-22844
09/15/2021, 3:23 AM$
is also problematic on shells (at least bash+zsh) as that is a var reference.proud-dentist-22844
09/15/2021, 3:24 AM#
would work as it evokes a URL-like anchor - ie it also dives downproud-dentist-22844
09/15/2021, 3:25 AM#
in the middle of the word with a comment.hundreds-father-404
09/15/2021, 3:38 AM$
is indeed a bad idea there
Cool, I like #
! (still open to further input, of course!)happy-kitchen-89482
09/15/2021, 4:25 AMDjango@3rdparty/python:reqs
now that I think of ithappy-kitchen-89482
09/15/2021, 4:25 AMhappy-kitchen-89482
09/15/2021, 4:26 AMhappy-kitchen-89482
09/15/2021, 4:27 AM@
hundreds-father-404
09/15/2021, 4:33 AMfoo.py@src/py/project:lib
, and subdir/f.py@src/py/project:lib
. I like the Django example, but not sure how I feel about those last two examples?curved-television-6568
09/15/2021, 5:27 AMfoo.pyāsrc/py/project:lib
but that is a pain to type (and also doesnāt really stand out), so not really viable.
Next up, @
, I think to use the at-symbol, we ought to respect the order of element@parent
to not confuse things too much, granted, it makes things look weird, given that it is not the order of path/to:target
so is a bad choice for that reason, which would be more conformant if it were foo.py@target:path/to
.
I agree with the notion of avoiding symbols with a special meaning when used unquoted in a shell, even if rarely used, to avoid mistakes (and forcing the use of quotes). If it wasnāt for that, I kind of like !
for its notion of being something āexceptionalā.
I like the #
as a way to further decompose the target
so path/to:target#foo.py
make sense to me. It also stands out well. :
, maybe too close(?), weāll see, and that is path/to:target;foo.py
. I like it, as it splits like a colon, almost.;
is of course not shell-safe either.
All in all, I think that whatever symbol, that the order of size should be consistent in a target address. Either going from large to small, or small to large, isnāt all that important. Both is commonly used. But to mix them so you have smallest X biggest Y middle
I think is a mistake.curved-television-6568
09/15/2021, 5:28 AMenough-analyst-54434
09/15/2021, 5:35 AM;
is ruled out by bash just like !
hundreds-father-404
09/15/2021, 5:36 AMBut to mix them so you haveĀ smallest X biggest Y middleĀ I think is a mistake.Good point, which I think is a reason
foo.py@path/to:tgt
reads the wrong way to me. It's smallest -> biggest -> middlewitty-crayon-22786
09/15/2021, 4:12 PM/
is banned in target names, it is also available:
3rdparty/python:requirements/Django
(for the django
target generated by a requirements
target)witty-crayon-22786
09/15/2021, 4:15 PMcurved-television-6568
09/15/2021, 4:15 PM:
in the middle is a typoā¦hundreds-father-404
09/15/2021, 4:16 PM/
in the generated_name
though. src/py/project:lib#path/to/some_util.py
And I realized we should ban :
in the generated_name
. The generated_name
is not really a target name like normal, because you can't have a generated target w/o referring back to its generatorcurved-television-6568
09/15/2021, 4:18 PM#
takes up more space, and also that is not an unusual use of hash-parts in URLs for instanceā¦witty-crayon-22786
09/15/2021, 4:18 PM/
in the generated name and still use it as a separator. everything after the :
is in a different namespacehundreds-father-404
09/15/2021, 4:19 PMand also that is not an unusual use of hash-parts in URLs for instanceā¦Yeah I like that connection a lot for
#
. In a URL, people already know #fragment
is how you get a more specific part of the entire page. Here, it's how you get a more specific target out of a generator targethundreds-father-404
09/16/2021, 5:18 AM#
. Thanks everyone! And thanks @bored-art-40741 for the idea š