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

Correct handling of debugging of py_binary targets when there is a transition #6600

Closed
andponlin-canva opened this issue Jul 29, 2024 · 5 comments
Assignees
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: Android Studio Android Studio plugin product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin product: PyCharm PyCharm plugin type: bug

Comments

@andponlin-canva
Copy link
Contributor

andponlin-canva commented Jul 29, 2024

Description of the bug:

Note: Please see associated PR here.

I have marked all IDEs because I assume they will all experience the same problem when handling Python targets but am only testing with Intelli-J.

When using a pinned Python interpreter, the expected behavior is that any py_binary targets that use the pinned interpreter will continue to be able to be debugged. The actual behavior is that the py_binary that uses the pinned interpreter is no longer able to use the debugger features in the IDE.

This problem is happening because the Rule type comes through from the aspect as _transition_py_binary and the logic in the plugin does not recognize this as a py_binary.

Which category does this issue belong to?

Intellij, GoLand, CLion, PyCharm, Android Studio

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Please find attached an example project
handle-rule-transitions-example-20240729.tgz.

  1. Unpack the tar-ball
  2. Run the binary with bazelisk run ":bin" and observe the output text Heizung.
  3. Open the workspace in the Intelli-J IDE with the Bazel plugin installed
  4. Open BUILD.bazel and right click on the bin target.
  5. Choose "Debug..."
  6. Edit the configuration
  7. Change "Bazel command:" to run
  8. Click OK
  9. Observe that the option to debug is showing as disabled

It should be the case that this py_binary is able to be debugged.

Which Intellij IDE are you using? Please provide the specific version.

Intelli-J 2024.1

What programming languages and tools are you using? Please provide specific versions.

Python 3.10

What Bazel plugin version are you using?

Recent

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

Screenshot without the patch;

handle-rule-transitions-example-before

Screenshot with the patch noting that the debug is now enabled;

handle-rule-transitions-example-after
@andponlin-canva andponlin-canva added awaiting-maintainer Awaiting review from Bazel team on issues type: bug labels Jul 29, 2024
@github-actions github-actions bot added product: Android Studio Android Studio plugin product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin product: PyCharm PyCharm plugin labels Jul 29, 2024
@andponlin-canva
Copy link
Contributor Author

Change merged - thanks.

@tpasternak
Copy link
Collaborator

Thank you for the contribution!

@tpasternak
Copy link
Collaborator

@andponlin-canva the problem I described in the comments above seems to be a rules_python issue, I thought you might be in interested bazelbuild/rules_python#2114

@rickeylev
Copy link
Contributor

Just to clarify a comment from the PR:

The root cause is the pinned rule exports @@rules_python//python/private/common:providers.bzl%PyInfo instead of PyInfo

This is, long term, WAI. The builtin PyInfo symbol will be dropped in favor of the symbol in @rules_python. The intellij plugin should be updated to recognize both.

@andponlin-canva
Copy link
Contributor Author

@rickeylev;

This is, long term, WAI. The builtin PyInfo symbol will be dropped in favor of the symbol in @rules_python. The intellij plugin should be updated to recognize both.

I don't see any further changes required in the scope of this specific PR for handling of the rules_python (Starlark native) PyInfo verses the Bazel built-in PyInfo; both should work OK here or do you see further handling being required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-maintainer Awaiting review from Bazel team on issues product: Android Studio Android Studio plugin product: CLion CLion plugin product: GoLand GoLand plugin product: IntelliJ IntelliJ plugin product: PyCharm PyCharm plugin type: bug
Projects
None yet
Development

No branches or pull requests

5 participants