Streamlit Tips, Tricks, and Hacks

Recently, I wrote an article discussing some tips and hacks that I learned within one year of using Streamlit in the data science team at SSENSE Inc. Some of these tips and hacks are not documented officially, and some may help you in tweaking your data science dashboards.

In this article, I am covering:

  • Page Config: This new function controls how to app should be started, and possible hacks related to this function.
  • Empty Function: By using this function, we can create content/element placeholders inside the dashboard.
  • Query String: The potential to connect your tools together using the query string to have a seamless experience.
  • Streamlit in a subfolder: There is an issue of accessing the parent libraries if Streamlit is being run from a subfolder.
  • Session: The implementation and use-case of the session to control UI interactions if they are in sequence.
  • SQLAlchemy: This is a common library to connect to multiple types of databases. However, it has a specific version for Flask and Tornado but it lacks a specific version for Streamlit. The SQLAlchemy vanilla may crash on Streamlit if being used in scale with a huge number of users at the same time.
  • Caching: Discussing caching features, their parameters, and how to use caching to store database connection.
  • UI Hacks: In Streamlit, developers can not change/modify the UI (except some themes), but here we have introduced how to make some changes including hiding the hamburger menu or specific items of the hamburger menu.
  • Record Screencast: This feature runs under some conditions, and we want to make sure how to keep all those conditions if this feature is important to you.
  • Components: Introducing some of the components that we used the most at SSENSE.

I hope that you will enjoy this, and it can help you with your Streamlit dashboards.