VSCode Python Launch setup

Running apps in the python debugger

The integrated debugger in vscode is nice, but the default capability is pretty limited. Adding new run/debug options requires adding JSON objects to the list in launch.json in the project. The below are some snippets to run some common types of python projects.

pytest

Adding the below will launch pytest against the currently active file

    {
        "name": "Pytest: Current File",
        "type": "python",
        "request": "launch",
        "module": "pytest",
        "args": ["-s", "-vvv", "${file}"],
        "console": "integratedTerminal",
        "justMyCode": true
    }

fast-api (or other uvicron)

    {
        "name": "Webapp",
        "type": "python",
        "request": "launch",
        "module": "uvicorn",
        "args": ["package.module:app", "--reload", "port", "8080"],
        "console": "integratedTerminal",
        "justMyCode": false
    }

django

    {
        "name": "Python: Django",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/manage.py",
        "args": ["runserver"],
        "django": true,
        "console": "integratedTerminal",
        "justMyCode": false
    }