4 Streamlit's execution model
This chapter covers
- Creating apps that require maintaining state between page updates
- Troubleshooting your apps effectively
- The all important st.session_state and st.rerun
- Streamlit's execution model
In the last two chapters, you've gotten your feet wet with Streamlit by building two fully-functional apps: a password checker and a unit converter. You've learned the basics of Streamlit's syntax and how to create interactive elements. But what happens behind the scenes when you run a Streamlit app? Understanding this is key to building more complex applications.
This chapter delves into the heart of Streamlit's execution model, where we'll explore how to manage an app's state.
This chapter also takes a slightly different approach than the previous ones. While we'll still build a practical application – a daily to-do list app – the primary focus is on equipping you with troubleshooting skills. We'll intentionally introduce some bugs into the app to simulate real-world situations where things might not go according to plan. By following along and fixing these issues, you'll gain a deeper understanding of Streamlit's inner workings and how to debug your own apps effectively.