Frankly, I feel the same, especially because I’m not a data scientist and because I’m constantly trying to bend streamlit’s standard usage to fulfill particular needs.
However, the framework has so much to offer even outside the data science scope and I’m convinced it’ll be able to cover more and more use cases as time goes by. That said, Streamlit is already quite useful to me. Just as @andfanilo and @Ian_Calvert said, it’s a great replacement (and improvement) for jupyter notebooks and even cli apps to some extent.
Well, the Streamlit way of handling things is just like calling a command line tool with a bunch of parameters.
But as you said, there’s this issue of managing state. The current problem here is when an app reruns, you can’t access a widget value prior its declaration/execution. However I’m not sceptical on this matter. One approach I’m working on is to bind a widget to a state variable like so:
print(state.value)
st.text_input("Blabla.", state="value")
state.value = "Hello" # This assignment updates the widget's value on screen
If you interact with a widget, the whole app will rerun with an up to date state directly from the beginning. Ideally you’d even be able to do something like the third line to set/update a widget value (or markdown text) without using st.empty()
: a bi-directional binding.
I’m really curious to see if something like this seems simple enough to use and could be a viable solution for state management with widgets.
You encountered the out of sync issue by doing something like this, right?
state.value = st.text_input("Blabla.", value=state.value)
If I’m right about what you’re refering to, I guess something like this should help. I know this is your typical “use this hack” answer , but we have no other solution than using hacks or waiting for an official implementation