Skip to content

Allow "request": "attach" and "autoReload": to auto-reload code in remote service #1874

Description

I would like to use debugpy to diagnose issues and try potential solutions in a running service. autoReload appears to be mutually exclusive with "request": "attach", only allowed if "request": "launch".

Is this a hard limitation that will never be possible?

Some of the services to be debugged are serving control systems for hardware on specific Kubernetes nodes, so using something like Telepresence to proxy traffic to a local instance of the service is not practical.

Ideally, launching with "request": "attach" and autoReload would connect to the service, allow live code changes and on disconnect return the code to its initial state. Any code changes are preserved on the developer machine and can be re-deployed, leaving the running service in an unknown state for the minimum amount of time.

Image
Snapshot of Intellisense telling me that autoReload is not allowed.

Activity

  1. rchiodo commented on Mar 21, 2025

    @rchiodo
    Contributor

    Reload is tricky, you can read more about it here (debugpy basically does the same thing as xreload):
    https://github.com/JayfonLin/xreload

    What you're asking for is reload on attach, which I'm not sure why it isn't supported. Seems like it could be. Essentially there's a thread in the debugger that's just sitting there waiting for file change notifications. It then attempts to reload the affected module. Not sure why that wouldn't work during attach.

    The putting everything back on detach would be iffy though. Reload doesn't always work. What if you made a change and it couldn't be put back?

  2. rchiodo commented on Mar 21, 2025

    @rchiodo
    Contributor

    Transferring to a discussion item

  3. locked and limited conversation to collaborators on Mar 21, 2025
  4. converted this issue into a discussion #1875 on Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions