Skip to content

patnan/streamlit-browser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streamlit Browser Extension

A VS Code extension that allows you to run Streamlit apps directly from the file explorer and view them in an integrated webview panel.

Features

  • Right-click integration: Right-click on any .py file in the VS Code explorer
  • Context menu: Select "Preview Streamlit App" from the context menu
  • Integrated webview: View the Streamlit app in a VS Code webview panel beside your editor
  • Virtual environment support: Automatically detects and uses your active Python virtual environment
  • Auto cleanup: Streamlit process is automatically terminated when the webview is closed

Requirements

  • VS Code: Version 1.74.0 or higher
  • Python: Python 3.6+ with Streamlit installed
  • Streamlit: Install with pip install streamlit

Installation

From Source

  1. Clone or download this repository
  2. Open VS Code
  3. Go to Extensions (Ctrl+Shift+X)
  4. Click "..." menu and select "Install from VSIX..." or load the extension folder

Development

  1. Open the extension folder in VS Code
  2. Press F5 to launch Extension Development Host
  3. Test the extension in the new VS Code window

Usage

  1. Right-click on any Python file (.py) in the VS Code explorer
  2. Select "Preview Streamlit App" from the context menu
  3. Wait for Streamlit to start (a few seconds)
  4. View your Streamlit app in the webview panel that opens beside your editor

Virtual Environment Detection

The extension automatically detects your Python environment in this order:

  1. VIRTUAL_ENV environment variable (if a virtual environment is active)
  2. Local .venv folder in your workspace
  3. Local venv folder in your workspace
  4. System Python as fallback

Example

Create a simple Streamlit app to test:

import streamlit as st

st.title("Hello Streamlit!")
st.write("This is a test app running in VS Code!")

name = st.text_input("Enter your name:")
if name:
    st.write(f"Hello, {name}!")

st.slider("Select a value", 0, 100, 50)

Right-click the file and select "Preview Streamlit App" to see it in action.

Troubleshooting

  • "No module named streamlit": Install Streamlit with pip install streamlit
  • "python: not found": Ensure Python is installed and in your PATH
  • Virtual environment issues: Activate your virtual environment before opening VS Code
  • Port conflicts: The extension uses port 8501 by default

License

MIT License - see package.json for details.

Contributing

Feel free to submit issues and pull requests to improve this extension.

About

Run Streamlit apps in VS Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published