Tips for Streamlit learnt the hard way
Transform your Streamlit experience with these top tips: from multipage simplicity to efficient caching and sleek layouts. Let’s dive in!
When I started in the Data Science space around 2015, I learnt it through R, and Shiny was the go-to framework to built interactive frameworks. Whilst I know that Shiny does also have a python integration, I remembered that Shiny could become quite difficult to manage and I needed a quick way to build demo or simple dashboards for our Data Science team. This is when I discovered Streamlit. In this post I want to cover some tips for Streamlit I have learnt in my journey with it.
Tips for Streamlit 1: Make your life easy with st.pages()
St.pages() is package developed by blackary, and believe, its simplicity makes it a no-brainer to use. Prior to st.pages(), one had to organise a multipage app by creating a pages folder and naming python files numerically (see streamlit’s example). That broke all my limited knowledge of software engineering… I didn’t want to configure things through hardcoded names!
St.pages() allows the user to do the following:
- Create a pages directory (required by streamlit), but with whatever naming you want to give each python file.
- Create a reusable function do define the ordering and actual naming of the pages you will see in the…