Today I want to share my vscode launch configuration for streamlit live debugging.

How to debug streamlit app in vscode

Usually I use the "program": "${file}" pattern to debug my python scripts. But this is not very useful for streamlit applications. I found a setup to debug a Python module instead, and I use it for my streamlit case.

{
   "version": "0.2.0",
   "configurations": [{
        "name": "Python: Streamlit",
        "type": "python",
        "request": "launch",
        "module": "streamlit",
        "env": {
            "STREAMLIT_APP": "app.py",
            "STREAMLIT_ENV": "development",
            "AWS_PROFILE": "mega_root",
            "PYTHONPATH": "${workspaceRoot}/src",
        },
        "args": [
            "run",
            "/Users/projects/streamlit/app.py"
        ],
        "jinja": true
    }
   ]
}