Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pythonPackages.debugpy: package request #89592

Closed
leungbk opened this issue Jun 6, 2020 · 4 comments · Fixed by #91448
Closed

pythonPackages.debugpy: package request #89592

leungbk opened this issue Jun 6, 2020 · 4 comments · Fixed by #91448

Comments

@leungbk
Copy link
Member

leungbk commented Jun 6, 2020

Project description
debugpy is an implementation of the Debug Adapter Protocol for Python.

Metadata

@kira-bruneau
Copy link
Contributor

kira-bruneau commented Jun 6, 2020

I already have a derivation for ptvsd in NUR (the original project). I will see if I can adapt it for debugpy.

@kira-bruneau
Copy link
Contributor

kira-bruneau commented Jun 24, 2020

@leungbk Sorry that this is taking so long. I spent quite a bit of time trying to get the tests to pass; now everything builds & passes successfully, but I'm having troubles using it with dap-mode in Emacs.

If you want to try it out, I have it available in my NUR repo.

@leungbk
Copy link
Member Author

leungbk commented Jun 24, 2020

@MetaDark Thanks a lot! The cli seems to work for me as well.

In Emacs, I seem to get something with the following changes to dap-mode:

---
 dap-python.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dap-python.el b/dap-python.el
index 09ced1f..c8272e2 100644
--- a/dap-python.el
+++ b/dap-python.el
@@ -190,7 +190,7 @@ as the pyenv version then also return nil. This works around https://github.com/
          (module (plist-get conf :module)))
 
     (plist-put conf :program-to-start
-               (format "%s%s -m ptvsd --wait --host %s --port %s %s %s %s"
+               (format "%s%s -m debugpy --listen %s:%s --wait-for-client %s %s %s"
                        (or dap-python-terminal "")
                        (shell-quote-argument python-executable)
                        host
@@ -215,7 +215,7 @@ as the pyenv version then also return nil. This works around https://github.com/
          (module (plist-get conf :module)))
 
     (plist-put conf :program-to-start
-               (format "%s%s -m ptvsd --wait --host %s --port %s %s %s %s"
+               (format "%s%s -m debugpy --listen %s:%s --wait-for-client %s %s %s"
                        (or dap-python-terminal "")
                        (shell-quote-argument python-executable)
                        host
@@ -238,7 +238,7 @@ as the pyenv version then also return nil. This works around https://github.com/
                                    :cwd nil
                                    :module nil
                                    :program nil
-                                   :request "launch"
+                                   :request "attach"
                                    :name "Python :: Run file (buffer)"))
 
 (dap-register-debug-template "Python :: Run pytest (buffer)"
-- 
2.27.0

Every other adapter uses launch locally, so this is probably not right. Vimspector seems to use launch for local debugging (https://github.com/puremourning/vimspector#python) and attach for remote debugging. I haven't inspected the source or tests of either Vimspector or debugpy very carefully. I'll take a closer look within the next few days.

It would be great if you could submit your derivation upstream here.

@kira-bruneau
Copy link
Contributor

@leungbk Thanks! Using "attach" instead of "launch" was the missing piece. It seems to work well after a bit of testing, so I will submit my derivation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants