Vs code debug

This worked for me:

{
    // 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 Debugger: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        },
        {
            "name": "Streamlit",
            "type": "debugpy",
            "request": "launch",
            "module": "streamlit",
            "console": "integratedTerminal",
            "justMyCode": true,
            "jinja": true,
            "args": [
                "run",
                "main.py",
            ]
        }
    ]
}

Thanks bjornba. It helped me a lot!

My version is simpler for Windows to debug Streamlit, it debug the app file in the root of the openned folder

{
    // 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: Streamlit",
            "type": "debugpy",
            "request": "launch",
            "module": "streamlit",
            "args": [
                "run",
                "app.py",
                "--server.runOnSave=true"
            ],
            "jinja": true
        }
    ]
}

How do you handle the case where you need to give args to the python script, I read adding “–” and then passing args but does not work with vs code. Would you have an idea?

This one worked for me. Thanks!

awesome thank you so much everyone. Even after all this time, this still works. Saved my ass!