https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

02/19/2023, 8:29 PM
Would like to know if this is bug ticket worthy before posting. I've got a file that is owned by one target with a custom name so
list
shows this
Copy code
$ ./pants list path/to/some/module.py
path/to/some/module.py:sources
Now, when I include it as a dependency by name in another target, I get an error like this
Copy code
$ ./pants dependencies path/to/dependee.py
13:24:45.87 [INFO] Initializing scheduler...
13:24:46.16 [INFO] Scheduler initialized.
13:24:50.01 [ERROR] 1 Exception encountered:

  ResolveError: The address path/to/some:some from the `dependencies` field of the target path/to:dependee_target does not exist.

The target name ':some' is not defined in the directory path/to/some. Did you mean one of these target names?
  * :sources
It's an easy fix but surprised I have to specify when it's unambiguous.
e

enough-analyst-54434

02/19/2023, 8:31 PM
Can you provide the actual dependency string you use?
Basically, if your expectation is that single target BUILD files should allow the single target to be addressed by not spelling out the target name, that is definitely not supported except for the default target, whose name must match the parent dir name (and this is the default when you leave off name in a target definition).
For a bug report, you'd want to point out how https://www.pantsbuild.org/docs/targets#target-addresses is contradicted; otherwise, this would be a feature request.
h

high-yak-85899

02/19/2023, 8:37 PM
Hmm, yeah I think more one the feature request side.
e

enough-analyst-54434

02/19/2023, 8:47 PM
Ok. What is the motivation for wanting to blur like that? Why not just use the default target name if you want to blur or else say what you mean? What purpose does this third option serve?
h

high-yak-85899

02/19/2023, 8:49 PM
We had some bad usage before that had folks use a different target name. I was mostly just surprised to see that it couldn't resolve the target when it was unambiguous.
e

enough-analyst-54434

02/19/2023, 8:59 PM
Gotcha. Perhaps a good way to think about things here is that Pants tries to infer things about your existing code. It tries to meet you where you're at. But that does not hold for Pants own configuration you have to add. That tends to expect explicitness.
3 Views