Skip to main content

Streamlit Use Cases

There are many use cases that the DataOps development environment optimizes, including building data apps with Streamlit.


Examples on this page are using DevReady, the DataOps development environment in your browser.

Rapid development of Streamlit app

This example assumes a Streamlit project at dataops/streamlit/houseprices.

Streamlit itself supports dynamic reloading, so if your app is simply something like, then in a terminal, just run:

streamlit run

This runs the Streamlit app and shows a preview in the DataOps development environment:

file invalid name !!shadow!!

However, many customers will want to render Streamlit apps specific to different branches/environments, so a Streamlit app built in the dev branch will point to the <DATAOPS_PREFIX>_DEV database.

The simplest way of doing this is to develop your Streamlit app as a Jinja2 template, e.g.,, and then use the DataOps renderer to render this. You can add a script to your Streamlit app directory that looks something like this:

# Ensure the environment variables and other environment-specific details are set

# Run the DataOps template renderer to render to
/home/gitpod/.pyenv/versions/3.8.13/bin/python /dataops-cde/scripts/dataops-render -o --file $STREAMLIT_FOLDER/houseprices/ render-template

# Tell the DevReady to expect to be previewing a web application on port 8501
gp preview $(gp url 8501)

# Run the Streamlit app
streamlit run ${STREAMLIT_FOLDER}/houseprices/ $STREAMLIT_FOLDER/houseprices/ --server.port 8501 --server.allowRunOnSave true --server.runOnSave true --browser.gatherUsageStats False

You must change some minor details, like the folder name to make this simple script work.

Now, when you run, it renders and previews the Streamlit app:

file invalid name !!shadow!!

This means you can work on your Streamlit app, move to the terminal, "Ctrl-C" out of the, rerun it, and see your new app within seconds.

Good, but we can do better. The problem here is that we are saving, and Streamlit is watching for changes. We need something that detects every time changes and reruns the render. For this, you can create a simple script:

# This watches for changes to the and when they are detected, reruns the
watchfiles "${STREAMLIT_FOLDER}/houseprices/" $STREAMLIT_FOLDER/houseprices/ --sigint-timeout 0 --sigkill-timeout 5

You can now run this instead of the, since it runs itself, and every time it detects a change to, it reruns the, which rerenders and previews: