The idea of Streamlit is to simplify application development by rerunning the entire application script whenever any user input changes. This strategy

Shiny for Python - Streamlit

submited by
Style Pass
2024-04-04 09:30:08

The idea of Streamlit is to simplify application development by rerunning the entire application script whenever any user input changes. This strategy leads to a great initial user experience, but quickly becomes constricting as your application grows in scope.

Shiny is designed to support your application’s growth without extensive rewriting; the patterns you learn when developing a simple app are robust enough to handle a complicated one.

Consider this basic Streamlit application which filters a dataset and draws two plots. The nice thing about this application is that it’s very similar to a non-interactive script. This makes getting started very easy because all you need to do to turn this script into an application is to add some Streamlit function calls to your variables and outputs. At the beginning, Streamlit doesn’t demand that you change your code to fit into a particular structure.

The way Streamlit achieves this is by rerunning your script from start to finish every time the user takes an action. While this works okay for small applications it is inefficient, and becomes intractable for larger more complicated ones. In this case clicking the Add Smoother button will cause the entire app to reload, even though the button is only used by one plot.

Leave a Comment