Hi, I want to be able to test various functions I use in my streamlit app through channels like ipython or pytest. However when I run functions that have the @st.cache() decorator they break. So is there a nice way to check if streamlit is running and disable those functions?
Ideally there should be a way to ignore streamlit calls when they do not make sense so that you can run the script in another environment without modification.
For the caching problem I’m thinking something like this:
def cache(): """Wrapper to disable streamlit caching when running with ipython """ def wrapper(function): if st.running: wrapped = st.cache(persist=True)(function) else: wrapped = function return wrapped return wrapper