Python
How to share a Python script with coworkers who do not have Python
Turning a script into something a colleague opens in a browser, with the steps that work today and the two places it will bite you.
Someone on your team has a script that works. It reads the bank export and the ledger export and finds the rows that do not match, and it saves an hour a week for exactly one person, because nobody else can run it.
This is one of the most asked questions in the Python world. A Streamlit forum thread from December 2022, how to share streamlit app locally without github for coworkers to launch, sets out the usual constraints: the data is confidential, GitHub should not be involved, and coworkers need to launch it without touching Python. That thread has been read more than forty thousand times.
First, work out which thing you are actually sharing
There are two different requests hiding behind “can I have that script,” and only one of them needs any of the work below.
If your colleague just needs the answer, send the answer. Have the script write an Excel file and email it every Monday at seven. Nobody has to run anything, and a scheduled job is far less work than everything below.
If your colleague needs to run it against their own files, whenever they want, then they need a version of the tool that does not involve installing Python. That is the rest of this post.
Why sending the .py file does not work
A Python file is not a program. It is a set of instructions for a program you have and they do not.
Running it means installing a matching Python version, installing every package the
script imports at versions that agree with each other, and opening a terminal in the
right folder. What your colleague sees when one of those is missing is
ModuleNotFoundError: No module named 'pandas', which tells them nothing about what to
do next, and the next message you get is a screenshot of it.
Packaging it into a double-clickable file with something like PyInstaller does work. What it costs you is that the fix you make in March has to be rebuilt and re-sent to everyone who has a copy, and you will not remember who that is.
Turn the script into a page
The move that works is to stop shipping a file and start shipping a web address. Streamlit is the shortest route for Python specifically, because it turns a script into a web page without you learning web development.
Only two things change: where the script gets its input, and where it puts its output.
Say this is what you have now:
import pandas as pd
bank = pd.read_csv("bank.csv")
ledger = pd.read_csv("ledger.csv")
merged = bank.merge(ledger, on="txn_id", how="outer", indicator=True)
print(merged[merged["_merge"] != "both"])
The hardcoded filenames become upload boxes, and the print becomes a table on the
page. Save this as app.py:
import pandas as pd
import streamlit as st
st.title("Transaction check")
bank_file = st.file_uploader("Bank export")
ledger_file = st.file_uploader("Ledger export")
if bank_file and ledger_file:
bank = pd.read_csv(bank_file)
ledger = pd.read_csv(ledger_file)
merged = bank.merge(ledger, on="txn_id", how="outer", indicator=True)
st.dataframe(merged[merged["_merge"] != "both"])
Then run pip install streamlit once, and streamlit run app.py to see it. Your
colleague now uploads their own files and reads the result in a browser, which is a
different tool from the one you had, even though the logic in the middle is identical.
If you are not sure which widget replaces which part of your script, paste it into the assistant that wrote the original and ask for the Streamlit version. The translation is mechanical.
Put it somewhere your colleague can reach
Running on your laptop only helps while your laptop is on. Close the lid on Friday and the link is dead until Monday morning. Streamlit Community Cloud hosts these for free, and there are two setup details that cause most of the failures.
The first is GitHub. Connecting a GitHub account is a required step, not an optional one, so this path is closed if your code cannot go there at all.
The second is dependencies, which
Streamlit names
as the main reason apps fail to build. You list your packages in a requirements.txt
file next to your script. Two useful details: Community Cloud already has streamlit
installed, and pandas and numpy arrive with it, so a simple app often needs no file
at all. Built-in modules like math and random should never be listed. Their docs
also warn to develop in the same Python version you deploy with, because built-in
libraries change between versions.
The thing to tell your colleague in advance
Free apps sleep. Streamlit’s documentation is blunt about it: apps without traffic for 12 hours go to sleep, and a visitor arriving at a sleeping app gets a page saying so, with a button reading “Yes, get this app back up!” Anyone with access can press it.
Twelve hours is shorter than it sounds. A tool used at month end is asleep every single time it is needed. The fix costs you one sentence in the message where you send the link, telling people that the wake-up button is normal and the app takes a moment. Skip that sentence and the first thing your colleague concludes is that the tool is broken.
The other thing worth saying out loud: a Community Cloud app is on the public internet. There is no sign-in in front of it unless you build one. For a tool that formats meeting notes, that is fine. For one that reads salaries, it is not, and you should stop here.
If the data cannot leave your network
Then Community Cloud is out, and the answer is the one that forum thread keeps landing on. Run the app on a machine inside your network that nobody turns off, which in practice means a spare desktop or a virtual machine your IT team sets up for you, and hand people the address it serves on.
This genuinely works and it is worth being clear-eyed about what you have taken on. Somebody now owns a machine. When it restarts after an update, the tool is gone until a human notices, and that human is you.
The other cost is quieter. The GitHub account is yours, the machine is yours, and six months after you change jobs the tool stops working with nobody left who knows why.
Where Sploot fits
Since this is our blog: we are building for the case above, where the folder is the input and sign-in with a work email is in front of the app by default. It is in private beta with nothing to log into yet.
So for this week, the recommendation is the honest one. If your data can leave your network, Streamlit plus a GitHub account is the shortest real path, and the sleep behavior is the price. If it cannot, the machine that stays on is still the answer, and it should be somebody’s job on purpose rather than by accident.