Function decorator to store singleton objects.
Each singleton object is shared across all users connected to the app. Singleton objects must be thread-safe, because they can be accessed from multiple threads concurrently.
(If thread-safety is an issue, consider using st.session_state to store per-session singleton objects instead.)
st.experimental_singleton(func=None, show_spinner=True, suppress_st_warning=False)
The function that creates the singleton. Streamlit hashes the function's source code.
Enable the spinner. Default is True to show a spinner when there is a "cache miss" and the singleton is being created.
Suppress warnings about calling Streamlit functions from within the singleton function.