Session State Introduction

I created a rough draft video showing an introduction to session state. I plan to re-record it with better audio and editing, but I wanted to get community feedback before I invested in a more polished presentation.

The video is aimed toward users who have either read through documentation already, or walked through their first app creation in another basic tutorial. Many questions in the Using Streamlit forum seem to boil down to details about session state, so these are the details I was figuring out in that first week or two of playing around with Streamlit.

(Video is processed up to 720p at time of posting. Higher resolution expected within a couple hours. )

Any thoughts feedback before I record the final version?


Super clear to me. I’m sure it’ll be very useful. (Not sure the assignment of ss.c2 will work on the first run as the key c2 will not have been created… best check that.)

1 Like

I know when I’m messing around with session_state (especially when making live edits) I can get the warning about a widget getting created. I’m trying to recreate it to get the exact message, but now that I’m trying it’s not breaking for me. I’m not having a problem just creating a key before the widget and having it initialize with that value, though.

In fact, Streamlit must have some ‘shadow memory’ besides what’s explicitly available by key. I’m getting a checkbox to remember its state even if I forcibly delete its key before rendering it (though it forgets if I build in extra interactions/page refreshes while its not rendered).

Looks like I have something to experiment with to put into a part 2. :slight_smile:

In my opinion describing the “best practice” approach rather than the nuances of edge cases will help 90% of your audience. Though I personally like the details, they’re not useful for most.

If you’re interested, I wrote a gist explaining some aspects of this topic here. I like your explanation better. :balloon:


1 Like

Hi @mathcatsand, just started going through your video. Informative, with examples - should help viewers realize how state values change during a refresh cycle.

I have a teeny suggestion though: however aesthetically possible, group your widgets into columns, so that the font in the right pane can be consequently increased. It will help those who view your video on mobile devices.

The other suggestions (audio, etc.) Are already part of your to-do list.


1 Like

Thanks @mathcatsand (and @asehmi for your gist referenced above). Both helped a lot with a session state issue that I’m grappling with. I found the video very practical and a great introduction to the dynamics of session state (beyond the absolute basics). It would have saved me a lot of time when I started using session state. Regarding feedback before you record a final version: I think this version works perfectly well as a final version!