Include debugpy in debug pex when configured as debugger#297
Include debugpy in debug pex when configured as debugger#297marcuscaisey wants to merge 4 commits intoplease-build:masterfrom
Conversation
toastwaffle
left a comment
There was a problem hiding this comment.
Your title says when requested, but this looks fairly unconditional to me. What am I missing?
|
The "request" I was referring to was the user specifying which debugger they want either through |
But reading your changes, aren't we going to end up including debugpy into every single pex we build, whether we're requesting it for debugging or not? |
Nope. My changes unconditionally include Example: please.nvim (master) unzip -l $(plz build -o=plugin.python.debugger:debugpy --config=dbg //experimental/python:ping) | rg debugpy | wc -l
550
please.nvim (master) unzip -l $(plz build //experimental/python:ping) | rg debugpy | wc -l
0 |
toastwaffle
left a comment
There was a problem hiding this comment.
I think the FreeBSD ports in https://github.com/please-build/python-rules/blob/master/third_party/cc/cpython/BUILD will need to be updated to get the tests to pass. You should be able to look them up on https://ports.freebsd.org/cgi/ports.cgi
third_party/python/BUILD
Outdated
| version = "1.8.20", | ||
| zip_safe = False, | ||
| # There doesn't seem to be a predictable URL for this version of debugpy so we need to resolve it instead. | ||
| tool = "//tools/wheel_resolver", |
There was a problem hiding this comment.
I suggest adding another target to tools/BUILD to get the prebuilt wheel_resolver to resolve the import cycle
Problem
Debugging a pex with the
debugpydebugger fails because thedebugpymodule is not found. For example:Solution
Include
debugpyin the debug pex.please_pexwas already trying to include it but it wasn't included inplease_pexitself.Other changes:
debugpyto the latest version as the version in the repo wouldn't build (there was some python 2 code that was being compiled). The wheel couldn't be found using the any of the predictable URL schemes defined byWHEEL_NAME_SCHEMEinthird_party/pythonso I just used the wheel resolver instead..bootstrapdirectory in the exploded pex directory tosys.path.debugpyis not zip safe so it needs to be imported from the non-zip-safe location.Tested my changes by overriding the pex tool to point to the new one:
I also hooked up an interactive debugger as a smoke test:
