https://pantsbuild.org/ logo
#development
Title
# development
b

bitter-ability-32190

06/27/2022, 1:54 AM
ā— ā— ā— 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

proud-dentist-22844

06/27/2022, 2:37 PM
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

bitter-ability-32190

06/27/2022, 2:39 PM
ā€¢ AFAICT PyCharm and IntelliJ don't support the DAP. šŸ˜ž ā€¢ No dependencies needed! Using a DAP is plug-and-play šŸŽ‰
p

proud-dentist-22844

06/27/2022, 2:40 PM
Bummer.
b

bitter-ability-32190

06/27/2022, 2:40 PM
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

proud-dentist-22844

06/27/2022, 2:44 PM
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

bitter-ability-32190

06/27/2022, 2:45 PM
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

proud-dentist-22844

06/27/2022, 2:47 PM
Agreed. I like interoperable stuff.
Maybe I can do something similar to add first class jetbrains debugger support... Very cool idea.
b

bitter-ability-32190

06/27/2022, 2:59 PM
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