Skip to content

debugpy attach request connect with No Config debugging #625

@ollie-bell

Description

@ollie-bell

I have a launch.json configuration:

{
    "name": "Python Debugger: Attach",
    "type": "debugpy",
    "request": "attach",
    "connect": {
        "host": "localhost",
        "port": 5678
    },
    "pathMappings": [
        {
            "localRoot": "${workspaceFolder}",
            "remoteRoot": "."
        }
    ],
}

This works fine with vscode python debugging tools... but what debugpy command actually gets run when this configuration is used? Is it possible to use the new No-Config Debugging instead of this launch.json configuration?

I've tried debugpy --connect localhost:5678 but I get

Error: invalid --connect <address>: --listen and --connect are mutually exclusive

when using debugpy shipped with the vscode extension (i.e. I haven't installed debugpy manually in my venv).

For context, I am connecting to a container which has a (simplified) Dockerfile:

FROM python:3.12-slim

RUN pip install "uvicorn[standard]" fastapi
RUN pip install debugpy -t /tmp

WORKDIR /app
COPY app.py .

ENTRYPOINT exec python -X frozen_modules=off \
    /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 -m \
    uvicorn app:app --host 0.0.0.0 --port 8080

Metadata

Metadata

Assignees

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions