Hi is there a goal called `resolve` which would sh...
# general
r
Hi is there a goal called
resolve
which would show me the resolve(s) for a given target similar to
dependencies
? Or what would be a way to get the resolve for a target? I am trying to debug a case where the test complains that the source file doesn't have the same resolve even though I have set the same resolve for the test and the source.
c
Hi Shantanu,
./pants peek :tgt
gives you Pants view of things for all targets matching your CLI specs..
1
r
It doesn't seem to have the resolve information
c
Then I’d suspect it uses the default resolve… hmm.. 🤷
h
Yeah, it uses the default if
peek
says it's None
r
I figured out my issue but even where pants is using correct resolve, it doesn't show up in
peek
. I can't find it anywhere in peek's output. I am pretty sure all of them are using the correct resolve.
h
Hm, what does your output look like? This is an example w/ Pantsbuild/pants repo
Copy code
[
  {
    "address": "src/python/pants/util/strutil.py",
    "target_type": "python_source",
...
    "interpreter_constraints": null,
    "resolve": null,
    "skip_autoflake": false,
    "skip_black": false,
...
  }
]
r
Copy code
[
  {
    "address": "src/pyfleet-vehicle-spec/tests:tests",
    "target_type": "python_tests",
    "dependencies": [
      "src/pyfleet-vehicle-spec/tests/test_main.py",
      "src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py"
    ],
    "description": null,
    "overrides": null,
    "skip_autoflake": false,
    "skip_bandit": false,
    "skip_black": false,
    "skip_docformatter": false,
    "skip_flake8": false,
    "skip_isort": false,
    "skip_mypy": false,
    "sources": [
      "src/pyfleet-vehicle-spec/tests/test_main.py",
      "src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py"
    ],
    "sources_raw": [
      "test_*.py",
      "*_test.py",
      "tests.py"
    ],
    "tags": null
  }
]
BUILD file is
Copy code
python_sources(name="tests", resolve="vehicle_spec")
h
Ah, try running on a specific
python_test
target like
./pants src/pyfleet-vehicle-spec/tests/test_panion_ds_vehicle_specs.py
What's going on is that the target generator
python_tests
(with an s) "moves" the field to generated targets and doesn't keep it itself. That was necessary for
parametrize()
+
overrides
to work properly cc @witty-crayon-22786, not sure how we could avoid user confusion here. It is definitely nuanced, and currently undocumented
🙏 1
r
I am using pants version
2.11.1rc2
h
Oh one idea: when you run
peek
on a target generator, add a key for
generated_targets
with a list of the addresses of everything generated A conceptual change in 2.11 is we leaned more into "target generators solely exist for boilerplate reduction".
peek
became less useful for target generators. "atom targets" are where all the interesting stuff happens