-
Notifications
You must be signed in to change notification settings - Fork 142
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
When using editable_mode=strict, breakpoints only hit for symlinked code in build/**, not original code #1152
Comments
Pylance doesn't implement a debugger. Did you mean to open this on the debugpy repo? |
Transferred to debugpy. My guess is that debugpy can't (or doesn't try to) follow symbolic links when matching up breakpoint paths. @int19h do you know if pydevd would use os.path.realpath on files while matching against breakpoint paths? @mcrumiller As a workaround, I believe you could use this to map paths between the build directory and real folder in your launch.json: {
"name": "Python current file",
"type": "python",
"request": "launch",
"args": [
"${file}"
],
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "build/__editable__.<package>-<version>-py3-none-any/"
}
],
} There's an example described in the VS code docs around remote debugging. |
@mcrumiller if you want symlinks resolved, please set the following environment variable in your launch:
|
Actually, the debugger should actually resolve symlinks when matching breakpoints by default (that setting is just so that the match given to the client would also be translated), so, I'll have to investigate more why it's not matching it in this case (a question: are you sure it's a symbolic link and not a hard link?) |
As a reference, the code in https://github.com/microsoft/debugpy/blob/v1.6.4/src/debugpy/_vendored/pydevd/pydevd_file_utils.py#L444 does |
If you open a python shell and do |
@fabioz it reports the separate path for each item: original path: >>> os.path.realpath(r"C:\Projects\project-brr\src\python\brr\fbo_sim.py")
'C:\\Projects\\project-brr\\src\\python\\brr\\fbo_sim.py' linked path: >>> os.path.realpath(r"C:\Projects\project-brr\build\__editable__.project_brr-2022.12-py3-none-any\brr\fbo_sim.py")
'C:\\Projects\\project-brr\\build\\__editable__.project_brr-2022.12-py3-none-any\\brr\\fbo_sim.py' |
Are you sure that's a link at all? If If this is the case you need to use the approach using |
I tested by altering one file and saving that file: the changes were immediately reflected in the other file. |
It's probably a hard link then, but I don't think hard links are resolvable (you have 2 different entries pointing to the same data, but I don't think one can be considered the canonical representation -- you need to delete both to erase the data). |
Ok; I'll use the |
This is related to microsoft/pylance-release#3473. Let me know if I should open this issue in the vscode-python repository instead of Pylance.
When using editable installs with a pure pyproject.toml installation (i.e. no setup.py available) as per PEP 660, installation requires
ediable_mode=strict
:This in turn creates a
build/__editable__.<package>-<version>-py3-none-any/<package>/
directory of symbolically linked files to the actual code itself.In order to activate breakpoints when debugging, breakpoints must be set on the code in the
build/**
directory; breakpoints on the original source code do not activate. This is a bit cumbersome, as the symbolic links are prone to break, which makes working directly on thebuild/**
files dangerous: changes made to these files may not be reflected in the actual package code.Environment data
Repro Steps
pip install -e . --config-settings editable_mode=strict
.Expected behavior
Debugger should hit breakpoint.
Actual behavior
Debugger does not hit breakpoint
The text was updated successfully, but these errors were encountered: