hundreds-father-404
11/16/2021, 12:02 AMpython_source(name="app", source="app.py")
Option 1: project:app
Option 2: project/app.py:app
đź§µwitty-crayon-22786
11/16/2021, 12:03 AMhundreds-father-404
11/16/2021, 12:04 AMpex_binary
etc
It makes it really easy to write this section on addresses: https://www.pantsbuild.org/v2.8/docs/targets#target-addresses
Otherwise, we need to explain how explicitly declared targets sometimes have the form path/to:tgt
and sometimes path/to/f.ext:tgt
witty-crayon-22786
11/16/2021, 12:05 AMhundreds-father-404
11/16/2021, 12:05 AMpython_source
and friends. They'll have the exact same address formatwitty-crayon-22786
11/16/2021, 12:07 AMI’m partial to it because it’s consistent with all other explicitly declared targets, likeÂi think that whether it is is explicitly declared is not what should be driving its address behavior: rather: “what is the atom”? for files, the atom is the file. for non-file targets, the atom is the target itself. etcpex_binary
hundreds-father-404
11/16/2021, 12:08 AMproject/f.py:lib
to be project:lib#f.py
I'm not certain I agree with that. I thinkkk I lean towards file arguments, but the main downside imo is it means we have three types of addresses:
• dir:tgt
• dir/f.ext:tgt
• dir:lib#tgt
The table on generated target addresses at https://www.pantsbuild.org/v2.8/docs/targets#target-generation is pretty confusing imowitty-crayon-22786
11/16/2021, 12:09 AMalso means that we want to stick with file address syntax (https://github.com/pantsbuild/pants/issues/12917), rather than changingÂi don’t think that this is accurate. making the behavior consistent with other targets now does not rule out all of those targets changing in the future. to beÂproject/f.py:lib
project:lib#f.py
hundreds-father-404
11/16/2021, 12:09 AMpython_source
?python_source
targets to also use generated address syntax, right? Good point! Okay, file addresses are irrelevant here then. Yay!witty-crayon-22786
11/16/2021, 12:10 AMhundreds-father-404
11/16/2021, 12:11 AMproject:app
should do in the original example? Alias for project/app.py:app
?
The CLI says project/app.py:app
always, but you can also write project:app
?witty-crayon-22786
11/16/2021, 12:12 AMproject/app.py:app
hundreds-father-404
11/16/2021, 12:14 AMwitty-crayon-22786
11/16/2021, 12:15 AMAddress.maybe_convert_to_target_generator
hundreds-father-404
11/16/2021, 12:17 AMname=
. We now need to see if you subclass SingleSourceField
and use its value to create the Address
I honestly am not sure how we'd implement this?witty-crayon-22786
11/16/2021, 12:18 AMhundreds-father-404
11/16/2021, 12:21 AMalias
to be the target generator's such that ./pants filter --target-type
and peek
workwitty-crayon-22786
11/16/2021, 12:22 AMhundreds-father-404
11/16/2021, 12:26 AM::
now matching generated targets in project introspection + adding overrides
We have less of a language to describe what's going on there, whereas right now I'm really happy with the conceptual clarity these changes brought to the docs
But worth considering..python_test_utils
I think I'd rather lean into the original question of what to do with the address of python_source
. That seems to be the only fundamental issue, right?
You've pointed out file addresses are irrelevantwitty-crayon-22786
11/16/2021, 12:30 AMFor example, I don’t know how we’d rewrite the help message ofÂto suggest using apython_test_utils
python_sources
target?hundreds-father-404
11/16/2021, 12:31 AMto suggest using a python_sources target? (Well, I think we would still want to use
python_test_utils
, not python_sources
. That was a good change to make and I'm convinced we'll be happy we moved conftest.py
out of python_tests
- I don't want to revert that partwitty-crayon-22786
11/16/2021, 12:31 AMpython_source
bit is orthogonal to that.hundreds-father-404
11/16/2021, 12:33 AMpython_source
should be?
2. Whether we revert atom targets for Pants 2.8 or lean into that first question?happy-kitchen-89482
11/16/2021, 12:41 AMproject/app.py:app
python_source
anyway?hundreds-father-404
11/16/2021, 12:43 AMpython_source
crashes Pants with dep inference, meaning we haven't used the target in the ~3 weeks it's landed till now. And I realized the much better fix was to use a python_sources
target with overrides
witty-crayon-22786
11/16/2021, 12:46 AMhundreds-father-404
11/16/2021, 12:47 AMhelp
messages something like "Generally, prefer using python_sources
for less boilerplate"witty-crayon-22786
11/16/2021, 12:47 AMhundreds-father-404
11/16/2021, 12:49 AMthat we would want to try to remove as the atom/generator split maturesI do think it will be tricky to change after a stable release, but yeah it is technically feasible to do. And we have
update-build-files
now to automatehelp
messages for atom targets to more explicitly recommend target generators
3. Land https://github.com/pantsbuild/pants/pull/13627 as a bug fixwitty-crayon-22786
11/16/2021, 12:51 AMcurved-television-6568
11/16/2021, 6:13 AMproject/app.py
for a file target? I think that tacking the target name onto the end is ugly (and superfluous as it can only belong to one target any way) and is preferable over project:app
for file targets as that doesn’t make sense until you are well versed in the target lingo.enough-analyst-54434
11/16/2021, 12:22 PMcurved-television-6568
11/16/2021, 12:28 PMenough-analyst-54434
11/16/2021, 12:31 PMpackage
for python distributions.curved-television-6568
11/16/2021, 12:34 PMenough-analyst-54434
11/16/2021, 12:37 PMwitty-crayon-22786
11/16/2021, 5:03 PM:target
doesn’t render… which in a freshly tailored well behaved repo is very very common:tests
)