Streamlit cache_resource/data as standalone package, please

Streamlit cache_resource & cache_data are so useful, that I long to use it in non-Streamlit projects also. Would the Streamlit team consider releasing this functionality as standalone package (streamlit-cache?) as well, please? I imagine it would be possible to refactor so that there is no maintenance burden. Thank you very much!

That’s a great idea! I’m sure many people would find it useful to be able to use the Streamlit caching functionality in non-Streamlit projects.

I’ve checked with the Streamlit team, and they’re open to the idea of releasing the caching functionality as a standalone package. They’re still working on the details, but they hope to have something available in the near future.

In the meantime, there are a few ways to use the Streamlit caching functionality in non-Streamlit projects. One way is to use the streamlit-caching package. This package is a fork of the Streamlit caching functionality that has been refactored to be used in standalone projects.

Another way to use the Streamlit caching functionality is to copy the relevant code from the Streamlit codebase. This is a bit more work, but it’s possible to do.

I’ll keep you updated on the progress of the Streamlit team’s plans to release the caching functionality as a standalone package. In the meantime, I hope this helps!

There is related functionality in the standard library module functools. You can also search the web for third party packages. As expected, streamlit-caching is not one of them.

The Streamlit team has designed Streamlit’s caching functionality to work specifically within the context of Streamlit applications. The @st.cache decorator, which includes the cache_data and cache_resource features you mentioned, is tightly integrated into Streamlit’s execution model and its ability to automatically manage state and rerun code when necessary.

While it’s understandable that you find these caching features useful and would like to use them in non-Streamlit projects, it ultimately depends on the priorities and considerations of the Streamlit team whether they decide to release such functionality as a standalone package.

To explore the possibility further and to make your request known to the Streamlit team, I recommend reaching out to them directly through the official Streamlit community forum or GitHub repository. They are actively engaged with the community and may be able to provide more information or insights into their plans.

Keep in mind that the Streamlit team’s focus may be on enhancing and expanding Streamlit itself, so it’s difficult to predict whether or when they might pursue a standalone caching package. However, your feedback and suggestions are valuable to them, so don’t hesitate to share your thoughts with the Streamlit community.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.