Html file cached by streamlit

Hello !

I used the tip provided here Ability to download data from Streamlit · Issue #400 · streamlit/streamlit · GitHub to include large html files into my streamlit app.
However my notebook modifies the file and writes it to disk but the changes are not “visible” to streamlit. The streamlit server sends 304 NOT MODIFIED responses when I reload my notebook and so I always get the old version, as if there were a caching mechanism in place in the streamlit local server.
I can currently overcome this by writing to a different file name but then I have to put in place a cleaning mechanism of the /static directory to avoid filling it with thousands of big files.

Does anyone ever encountered this issue ?

Thanks for your help and for this awesome tool !

I solved this by monkey patching StaticFileHandler to not cache files by filename.

from streamlit.server.server import StaticFileHandler

@classmethod
def _get_cached_version(cls, abs_path: str):
    with cls._lock:
        return cls.get_content_version(abs_path)


StaticFileHandler._get_cached_version = _get_cached_version