Uh oh!
There was an error while loading. Please reload this page.
Include debugpy in debug pex when configured as debugger - #297
Include debugpy in debug pex when configured as debugger#297marcuscaisey wants to merge 2 commits into
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 |
toastwaffle
commented
Apr 2, 2026
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
Uh oh!
There was an error while loading. Please reload this page.
03befa9 to
1510fe0Comparetoastwaffle
commented
Apr 9, 2026
#300 should fix the freebsd stuff fyi |
I had to update them again (i've separated this into its own commit) 😅 I've added the pre-built Btw, the tests on darwin platforms (amd64 and arm64) seem flakey. Some failing jobs which passed on retry on my branch:
All looks like the same kind of failure. The libpython shared object can't be found. |
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.//tools:wheel_resolvertarget which downloads a pre-builtwheel_resolverbinary. This resolves an import cycle betweendebugpy -> wheel_resolver -> please_pex -> debugpy.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:
