Can debugger forward "source" requests to debugpy?
- 主要语言
- Python
- 星标
- 734
- 派生
- 412
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 8
描述
The current handler for "source" requests to the debugger is as follows:
https://github.com/ipython/ipykernel/blob/221dca63d7b2e2b8fea32bf8a101d07645fc9d3c/ipykernel/debugger.py#L427-L445
Intuitively, I would expect that the source request would be forwarded to debugpy, so that the [more complete implementation of pydevd](https://github.com/microsoft/debugpy/blob/cf0d684566edc339545b161da7c3dfc48af7c7d5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py#L1108-L1140) could handle the request. Some differences of that implementation:
- Both implementations tries direct file access first.
- pydevd then tries the [`linecache`](https://docs.python.org/3/library/linecache.html) with the following comment:
> File might not exist at all, or we might not have a permission to read it, but it might also be inside a zipfile, or an IPython cell. In this case, linecache might still be able to retrieve the source.
- Finally, pydevd falls back to using the sourceReference supplied (which would previously be given on e.g. "module" events I think).
One of the advantages of the approach of pydevd is that it also is able to handle modules that are loaded from custom module loaders (zip file loader, DB loaders, web loaders, etc.). It would therefore be good if someone could write out why we're not simply forwarding the request to debugpy, and if there is a solid reason for it, maybe we could improve upon it so that we can still support the sourceReference field?
贡献指南
调研方向
Start in ipykernel/debugger.py at the current source request handler linked in the issue, then compare it with the referenced debugpy pydevd implementation. Investigate why requests are not forwarded and how sourceReference is supplied for module events. Done means the supported source lookup behavior and any needed sourceReference handling are covered by tests.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100