Discover more from Insignificant Data Science
Announcing st-paywall: a python package for creating paid Streamlit apps
also: why is it so hard for data scientists to make money online?
TLDR: I decided to complain by building and created st-paywall, which integrates with Stripe and Google to make it dead simple to create subscription Streamlit apps. This means you can charge for some of the excess value in your data science work.
pip install st-paywall, and let me know what you think here.
I’m jealous of the software engineering class. The small boostrapped websites, mini software tools, proper consulting gigs, etc. What say the data scientist? Nothing.
This topic has been eating at me for years. After I started at Meta, I did the usual new grad thing of trying to make extra cash on the side. I tried:
Resume advising (sucks)
Interview prep (well paid but the best thing I got out of it was my friend Jay)
Consulting (awful, waste of my life)
Then I thought more carefully about what I was doing, and realized that I didn’t want to continue to sell my time off of work hours, and wanted to start a proper side hustle.
The problem was, well, there were a bunch of problems. But the biggest one is that the average person does not consume data science one off. The end product is not clear! We (data scientists) usually promise better decision making. Or insights. Or justification for priors. Or whatever.
So I gave up on the bootstrapped data science product idea. Since then, there have been two developments that have changed my mind on the whole space.
Streamlit became wildly popular
I’m biased, because I thought the product was dope and so I wrote a book on it, then quit my job and started to work for the creators. But Streamlit is awesome. It is a UI layer for Python, and is wildly easy to get started on. This made the end product pretty clear to me: data scientists want to build web apps, people like pretty buttons they can click and sliders they can mess around with. Match made in heaven.
LLMs became even more wildly popular
The combo of #1 and #2 caused some problems. If I, a developer, made a web app that used an LLM, I was almost certainly paying money for it. That sucks! It is the opposite of a side income.
I was no closer to my solution. But then I realized I know python and can try and fix this. So long story long, I created st-paywall. st-paywall is a python package that adds Google authentication to your Streamlit app, pulls your customer list for your new shiny product from Stripe, and appropriately prompts people to log in or subscribe as needed. By default, it will stop your app completely if they are not both logged in and subscribed. You can check it out here, and here is the GitHub repo.
The API is as simple as I could think to make it. If you put add_auth() to the top of your Streamlit app’s script, it will create the appropriate buttons in your sidebar and place the user’s email and subscription status in the app’s state. This is the entire app script for the demo app!
import streamlit as st from st_paywall import add_auth st.title("🎈 Tyler's Subscription app POC 🎈") st.balloons() add_auth(required=True) st.write("Congrats, you are subscribed!") st.write('the email of the user is ' + str(st.session_state.email))
As you can see, the
st.write() simply does not run until I logged in. Here is a unbelievably long gif to show you.
Wow if you’ve read this far we’re either friends, you work for Streamlit, or you really want to create paid Streamlit apps. I have the fervent belief that there should be hundreds of small businesses, entirely built on Streamlit by individual developers. I hope I’m proven right, and that this pulls that future a little closer to the present.