Streamlit is an open-source Python library that makes it easy to build beautiful custom web-apps for machine learning and data science.

Example Streamlit app.


Streamlit apps can be deployed with the rsconnect-python package.

For Streamlit apps, the entrypoint is the name of the Python file containing your app. For example, if your app’s source file is named, use:

rsconnect deploy streamlit \
    -n <saved server name> \
    --entrypoint \ ...

Example apps

There are some Streamlit example apps available from the Streamlit developers:

To deploy one of these examples, first clone the repository:

git clone<app-name>

Install any required dependencies. Then, test the app locally:

streamlit run <app-name>/

Then deploy to Posit Connect:

rsconnect deploy streamlit \
    -n <saved server name> \
    --entrypoint \

User meta-data

This example shows an internal Streamlit API pattern you can use to retrieve the username and group information provided by Connect. This code might break in future releases (last tested with Streamlit version 1.23.1). Refer to the Streamlit GitHub issue reference for updates on this feature.

import json
import streamlit as st
from streamlit.web.server.websocket_headers import _get_websocket_headers

def get_user_info():
    headers = _get_websocket_headers()
    user_info_json = headers.get("Rstudio-Connect-Credentials")
    if user_info_json is None:
        return None
    return json.loads(user_info_json)

def get_username():
    user_info = get_user_info()
    if user_info is None:
        return None
    return user_info.get("user")

st.write("Username: " + get_username())

User and group uniqueness

Most environments have unique usernames where each user identifies a single user and groups the name of the groups the user is a member of.

However, in large organizations with hundreds of users and groups, this may not be true. See the Admin Guide sections Credentials for Content for more information.


Version compatibility

  • Posit Connect requires Streamlit v56.1 or higher.

Bokeh compatibility

  • Streamlit versions starting with 0.57 require Bokeh 2.0 or higher.
  • Streamlit versions prior to 0.57 require Bokeh 1.4.
  • Bokeh charts embedded within Streamlit can use Javascript callback functions, but Python callbacks from Bokeh are not supported by Streamlit.