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

Could a disable_attach API available? #297

Closed
buddyliao opened this issue Jun 12, 2020 · 11 comments
Closed

Could a disable_attach API available? #297

buddyliao opened this issue Jun 12, 2020 · 11 comments
Labels
enhancement New feature or request

Comments

@buddyliao
Copy link

ptvsd offers an enable_attach() API for us to start the debug, however, if we want to disable the debugger, we need to restart the python process, I am wonder whether a disable_attach API is available for us to stop the debugger?

@fabioz
Copy link
Collaborator

fabioz commented Jun 12, 2020

As debugpy is built upon pydevd, I think you can use:

import pydevd
pydevd.stoptrace()

for that.

-- please let me know if that works for you (if it does a debugpy wrapper should probably be provided for that to keep it consistent with other calls).

@fabioz
Copy link
Collaborator

fabioz commented Jun 12, 2020

@buddyliao as a note, ptvsd is now rebranded as debugpy (so, new issues should go there).

@karthiknadig @int19h can you move this issue to https://github.com/microsoft/debugpy?

@buddyliao
Copy link
Author

buddyliao commented Jun 16, 2020

Dear fabioz,
Thank you for your reply.
I know pydevd has API stoptrace, but it seems like that it doesn't have api to wait for client's attach, like debugpy.wait_for_client or ptvsd.wait_for_attach.

As debugpy is built upon pydevd, I think you can use:

import pydevd
pydevd.stoptrace()

for that.

-- please let me know if that works for you (if it does a debugpy wrapper should probably be provided for that to keep it consistent with other calls).

@fabioz
Copy link
Collaborator

fabioz commented Jun 16, 2020

I wasn't suggesting that you use it for client attach, just to stop tracing while there's no debugpy equivalent -- or maybe I'm misunderstanding... what do you expect from `debugpy.disable_attach'?

@int19h int19h transferred this issue from microsoft/ptvsd Jun 16, 2020
@buddyliao
Copy link
Author

buddyliao commented Jun 17, 2020

Thank you fabioz.
I want to use IDE to debug remote python app, so I also need a wait_for_attach API in some situations. For disable_attach API, just stop tracing is OK. Actually, pydevd.stoptrace() works, but it's better if pydevd.stoptrace is packaged in debugpy.disable_attach API. Since I just need to import debugpy module, otherwise I also need to import pydevd module as well.

@int19h int19h added the enhancement New feature or request label Jun 17, 2020
@int19h
Copy link
Contributor

int19h commented Feb 1, 2023

Since the API is now debugpy.listen(), the proposed counterpart would be named debugpy.stop_listening().

@judej
Copy link

judej commented Jan 3, 2024

Thank you for the report. Given our current resources are working on the Python 3.12 debugger, we will not be fixing this issues in the pre Python 3.12 debugger.

@judej judej closed this as completed Jan 3, 2024
@Andrej730
Copy link

Is there some current workaround to stop the debugging server? pydevd.stoptrace() doesn't seem to help.
Can we keep this issue open to indicate that it's unresolved?

import debugpy
port = 9992
debugpy.listen(port)
print('start debug server')

import pydevd
pydevd.stoptrace()
print('debug server stopped')

debugpy.listen(port)
# RuntimeError: timed out waiting for adapter to connect

# never printed:
print('debug server restarted')

@heartacker
Copy link

please

@nhadziosma1
Copy link

There is so much of us who would really appreciate if you could implement a function like debugpy.stop_listening() and/or debugpy.disconnect(), and thus I think that this issue should not be considered as 'Closed', but actually prioritized.

@heartacker
Copy link

yes please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants