I created a multipage version of a Streamlit app, that demonstrates several charts about static site generators (SSG) popularity (Hugo, Gatsby, Jekyll, sphinx, etc).
App: https://ssg-dataset.streamlit.app
Repo: GitHub - epogrebnyak/ssg-dataset: Open reproducible dataset on static site generators (SSG) popularity.
The dataset is collected from Github API and has repo names, stars, forks, issues, create and modify dates. There is a Python package to process this data, that results in a CSV file in project repo. The app reads the data and lays out several charts - by programming language, issues vs forks, years project is running and several projects without recent commits.
Multipage option is great, helps to focus on each part of the content, pages are shorter and tell one thing or topic.
Here are some things I learned while creating the app:
-
I used ChatGPT to come up with an icon for the page, which really saved time.
I asked about what icons could I use and where the icon looked poorly on actual site,
asked again for more options. Much more satisfying than browsing emoji tables for a fun
pictogram. -
I used two approches for badges:
- For a badge with a number of SSG in a dataset, that I ended up creating locally with
npm badge-maker
. There was also some code withpybadges
, butbadge-maker
allowed to use a one-liner (you can checkbadge
command injustfile
). - I relay poetry project version number to a Github tag, and make a release badge based on this tag though a regular Shields API.
- For a badge with a number of SSG in a dataset, that I ended up creating locally with
-
Someone mentioned it is nice to have Github colors for programming language, which I did (
palette()
function).
Open question - is st.session_state
ok to save a dataset?
-
I used
st.session_state
to communicate the CSV data between pages, initialised at homepage. The state was not really changing, just some way to communicate my dataset between pages. The only discomfort is when a browser is pointing to a sub-page after restart, there is an error about no data available. Perhaps this not a likely scenario for a hosted page (the user always comes to home page, I assume). -
My initial solution attempt was to use
data.py
and import it as a data store to everypage which did not work well – how to make it discoverable by home page and pages, make data actually persist and guarantee I’m not reading the CSV repeatedly – I could not resolve that quickly andst.session_state
seemed a quicker solution.
Footer:
- If I had access to page tree, I think a footer at each page made sense, what section to read next.
- Also some global header and footer can be useful, but probably not a priority for streamlit as a library.