extra_streamlit_tools.utils

Module Contents

extra_streamlit_tools.utils.clear_cache(keep_keys: Optional[list[str]] = None) None

Resets the Streamlit cache.

Parameters:

keep_keys (Optional[list[str]]) – Keys to not be cleared from cache

extra_streamlit_tools.utils.init_session_keys(key_value_pairs: dict[str, Any]) None

The init_session_keys function is a helper function that initializes the session state with keys and values.

Parameters:

key_value_pairs (dict[str, Any]) – A dictionairy of key_value_pairs

extra_streamlit_tools.utils.change_in_session_state(key_value_pairs: dict[str, Any])

The change_in_session_state function is a helper function that allows you to change session state values.

Parameters:

key_value_pairs (dict[str, Any]) – Dictionairy with the Streamlit session_state key and the its new value

extra_streamlit_tools.utils.set_selectbox_index(selectbox_key: str, session_state_var_name: str, values: list[Any]) None

The set_selectbox_index function is a helper function that sets the index of a selectbox to the value of another session state variable. This is useful when you want to set the default value of one selectbox to be equal to another, but you don’t know what that other’s default value will be until runtime.

Parameters:
  • selectbox_key (str) – Specify the key of the selectbox

  • session_state_var_name (str) – Set the session state variable name

  • values (list[Any]) – The list of values in the selectbox