debugging VS代码中的诗歌包调试正确启动和设置json

mrphzbgm  于 2022-12-29  发布在  其他
关注(0)|答案(1)|浏览(121)

我正在使用poetry构建一个包,并且已经创建了我的包名和venv。
From the command line i can run poetry run package-name --flags and it will run my cli.py and references to appropriate imports etc.
My cli.py has from package-name import module . Everything works.
然而在VS代码中,我试图让它从调试器接口运行这个命令,^^在启动和设置json中声明适当的参数。
我原以为会是这样

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${workspaceRoot}/package-name/cli.py",
            "args": [
                "removeuser",
                "--ini",
                "../../ini/test.ini"
            ],
            "console": "integratedTerminal"
        }
    ]
}

但这不起作用。你知道什么是正确的配置吗?
先谢了。

lawou6xi

lawou6xi1#

我觉得你需要这样的东西:

{
    "name": "Python: Poetry CLI application",
    "type": "python",
    "request": "launch",
    "module": "poetry",
    "args": [
        "run",
        "package-name",
        "removeuser",
        "--ini",
        "../../ini/test.ini"
    ],
    "console": "integratedTerminal"
}

我正在做类似的事情,但还没有找到更好的解决方案

相关问题