:exclamation: :exclamation: :exclamation: You may ...
# development
b
ā— ā— ā— You may have seen that users can debug their Python tests without any code changes You may be looking forward to users being able to debug their Python scripts the same way But wait until you've seen debugging Pants itself! Coming to your repo near you! (no more print-style debugging!)
šŸš€ 5
ā¤ļø 1
šŸ‘– 2
šŸ™Œ 2
p
Cool! I wonder if this would facilitate debugging with PyCharm. Can it inject dependencies so I don't have to hard code it? https://www.pantsbuild.org/docs/python-test-goal#running-tests-interactively
b
ā€¢ AFAICT PyCharm and IntelliJ don't support the DAP. šŸ˜ž ā€¢ No dependencies needed! Using a DAP is plug-and-play šŸŽ‰
p
Bummer.
b
VSCode supports DAP+Python, as does (it looks like) emacs and vim.
From Late 2019: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004975119-PHPStorm-and-Visual-Studio-Code-Debug-Adapter-Protocol
Nope, not supported and hardly will ever be.
Which the post is about PHP, but still doesnt bode well
p
Maybe I'll have to look at using it with vim. Normally I use PyCharm (it's one of the two apps I actually pay for on my Linux laptop, GoLand is the other) to debug python stuff.
b
I'm a fan of Open Source, so no ragrets. It's sad JetBrains won't support a language-less open-support debug protocol with so many implementations. Even Eclipse flavors jumped on board.
p
Agreed. I like interoperable stuff.
Maybe I can do something similar to add first class jetbrains debugger support... Very cool idea.
b
I'm not opposed to it, I want our users to find easy success. However I think the only reason I got away with polluting
run
and
test
is because the DAP is an open-source language-agnostic protocol, so it would apply to all supported languages*. If/when we add better support for JetBrains IDEs, we need to consider the scope of the options. Perhaps
--debug-adapter
can be morphed into
--debug-server
, with a swappable backend which defaults to using the relevant
dap
.
āž• 2
It only took several days of headscratching, but I got this working only initializing debug tracing once-per-thread, offering damn-near-native performance. We're back on, and it'll be in hopefully soon šŸ˜‰
šŸ™Œ 2
It's in! Happy debugging!
šŸŽ‰ 1
At some point, I'll make this an installable pants plugins so you can debug your plugins. But that'll take more thinking