-
Notifications
You must be signed in to change notification settings - Fork 189
Description
Environment data
- debugpy version: 1.5.1
- OS and version: masOS 12.2.1
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.9.10
- Using VS Code or Visual Studio: VS Code
Actual behavior
I have a click application (https://click.palletsprojects.com/en/8.0.x/) that is configured to run as a poetry script. I have a launch.json config that can successfully launch the script, accept the arguments, and hit breakpoints that I set inside of the click functions.
The issue is that the debugger detaches after 6 seconds no matter if breakpoints are set, the code is allow to run uninterrupted, using different arguments to trigger a different function, etc.
The call stack is showing the CLI file and the functions I break at to be inside a subprocess, and I have subprocess set to true, but I am wondering if this is part of the issue.
I have reviewed this ticket and would expect this to work fairly similarly.
Expected behavior
The debugger would launch and allow stepping, etc, as usual.
Steps to reproduce:
- Create a
clickfile (below is using the example from their hello world)
# testcli.py
import click
@click.command()
@click.option('--count', default=1, help='Number of greetings.')
@click.option('--name', default='Your name')
def hello(count, name):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo(f"Hello {name}!")
if __name__ == '__main__':
hello()
- Create a
poetryproject with a script pointed to a python file usingclick
# pyproject.toml
...
[tool.poetry.scripts]
hello = 'testcli:hello'
...
- Add a
launch.jsonconfig that can runpoetry
{
"version": "0.2.0",
"configurations": [
{
"name": "Foobar CLI",
"type": "python",
"request": "launch",
"program": "${env:HOME}/.poetry/bin/poetry",
"args": ["run", "hello"],
"console": "integratedTerminal",
"justMyCode": false,
"subProcess": true,
}
]
}