Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peek output for target generators like python_tests do not include relevant goals #20886

Open
huonw opened this issue May 7, 2024 · 3 comments
Assignees

Comments

@huonw
Copy link
Contributor

huonw commented May 7, 2024

Is your feature request related to a problem? Please describe.

As of #20331, peek now can indicate some goals that apply for some targets (very cool). It looks like this mostly works for single-file targets, not generators like python_tests. Those generators are valid sources of some goals (e.g. test, lint etc.), although not all goals that they're isolated files are valid for (e.g. run only works with one file).

In https://github.com/pantsbuild/example-python (at 55cf90bc4a1e4ccc47749aa39d299b5dace79adc), running PANTS_VERSION=2.21.0a0 pants peek --exclude-defaults helloworld/greet:tests helloworld/greet/greeting_test.py (--exclude-defaults just to make this output nicer):

[
  {
    "address": "helloworld/greet:tests",
    "target_type": "python_tests",
    "dependencies": [
      "helloworld/greet/greeting_test.py:tests"
    ],
    "sources": [
      "helloworld/greet/greeting_test.py"
    ],
    "sources_fingerprint": "2158e096d5ab63e537d88067b50a0274b83f6373143faf854d4a9adf5d01cf78"
  },
  {
    "address": "helloworld/greet/greeting_test.py:tests",
    "target_type": "python_test",
    "dependencies": [
      "helloworld/greet/greeting.py:lib"
    ],
    "goals": [
      "run",
      "test"
    ],
    "source_raw": "greeting_test.py",
    "sources": [
      "helloworld/greet/greeting_test.py"
    ],
    "sources_fingerprint": "2158e096d5ab63e537d88067b50a0274b83f6373143faf854d4a9adf5d01cf78"
  }
]

Note that:

  • helloworld/greet:tests has no goals key
  • helloworld/greet/greeting_test.py:tests does have one

Describe the solution you'd like

Include appropriate goals output for target generators too, somehow.

Describe alternatives you've considered
N/A

Additional context
N/A

@huonw huonw changed the title Target generators like python_tests do not include relevant goals peek output for target generators like python_tests do not include relevant goals May 8, 2024
@sureshjoshi
Copy link
Member

Man, what a swing and a miss on my part - I didn't even think about generators honestly.

I guess that explains a weird artifact in the vscode plugin I just noticed (why I wasn't getting code lens support for python_tests). I just assumed it was the plugin's fault and went on with my day.

But, on the plus side - goals does let me do something super dope like this:
Screenshot 2024-05-08 at 21 37 50

Anyways, I'm back on the vscode plugin tomorrow - so I'll probably try to tackle this bug in the next week or so.

@sureshjoshi sureshjoshi self-assigned this May 9, 2024
@huonw
Copy link
Contributor Author

huonw commented May 9, 2024

That is cool! Doesn't seem like a miss to me, just a feature delivered over several incremental steps 😄

@sureshjoshi
Copy link
Member

Yeahhh... Let's go with that 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants