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

feat: add ability to pass user flags to python interpreter #442

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

muravev-vasilii
Copy link

This change is meant to demonstrate the proposed update for the following feature request: #436


Changes are visible to end-users: yes/no

Users can influence behaviour of interpreter by setting flags via setting env variable RULES_PY_USER_INTERPRETER_FLAGS

Test plan

  • Manual testing;

Ran bazel target with

RULES_PY_USER_INTERPRETER_FLAGS="-m debugpy --listen 12345 --wait-for-client" bazel run //path/to/rules_py/py_binary/target

From VSCode side:

  • installed Python Debugger extension
  • updated launch.json with
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Attach",
            "type": "debugpy",
            "request": "attach",
            "connect": {
              "host": "localhost",
              "port": 12345
            }
          }
    ]
}

Used Run&Debug tab in VSCode to set breakpoints, connect to program and debug

@CLAassistant
Copy link

CLAassistant commented Nov 20, 2024

CLA assistant check
All committers have signed the CLA.

@mnoah1
Copy link

mnoah1 commented Nov 20, 2024

Also, one other change for the debug use case is that the run template should set the PYDEVD_RESOLVE_SYMLINKS environment variable to true before starting debugpy. This resolves symlinks when sending paths to the client. Without this set, VS Code will open any paths within the Bazel cache as their own tab instead of showing the breakpoint in the original source file. More info: microsoft/debugpy#743

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

Successfully merging this pull request may close these issues.

3 participants