I made a small VS Code extension that lets you run Streamlit apps directly from the right-click menu. I found myself constantly opening terminals to run different apps during development, so I thought this might be helpful for others too.
Why not just create a debug config (.vscode/launch.json) - for either a specific file (for large projects with specific entry point) or for currently opened file - and press F5 to run it? You also get debugging breakpoints that way.
Updated: added sample config:
{
// 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": "debug streamlit",
"type": "python",
"request": "launch",
"program": ".\\.venv\\Scripts\\streamlit.exe", // "./.venv/bin/streamlit" on linux,
"args": [
"run",
"${file}" // "${file}" for the current file or specific file with relative path
]
}
]
}
I agree… on Windows I do it this way and have several of them in my launch.json because I want a selection of server ports (Why? Because I have a personal gists project with dozens of Streamlit apps all on the go… if you know of a way to randomize that port number, please let me know?)