I used to share my Python automations as .exe files
Early in my career, one of the first automations I built solved a real problem. Writing it wasn't the hard part. Getting it to the people who needed it was.
The problem: files buried in email threads
We had customers who worked with us over email: tens of people on one thread, replying for weeks, attaching files whenever they had a new version. We were expected to keep track of all of it and produce the output.
The right fix was a better process, with one place for files instead of everyone's inbox. Everyone could see that. But like most things in business, the snowball was already rolling. The customers were used to email, the threads were already long, and nobody was going to stop and redesign how we worked mid-project.
So the job was, over and over: open a thread, scroll through dozens of replies, find every attachment, save each one, work out which version was the latest, and file them somewhere sensible.
The script was easy
Pulling attachments out of my own inbox with Python took an afternoon. Read the emails, group them by thread, save every attachment into a folder named after the subject. Done.
Then I hit the real problem: most of those emails weren't in my inbox. They were in my coworkers' inboxes. Each of them was on different threads with different customers. My script could only see my mail.
The workaround: an .exe for everyone
I needed my coworkers to run the script themselves, on their own machines, against their own mail. None of them were going to open a terminal or install Python. So I did what a lot of us have done:
- Built a small form in tkinter, so they had something to click instead of a command line.
- Bundled the script and the form into an .exe with PyInstaller.
- Shared the .exe with the team.
And it worked. People used it. But it was fragile in all the ways you'd expect:
- Sharing executables is a bad habit to teach people. An unsigned .exe from a coworker looks exactly like what security training tells everyone not to open. Windows SmartScreen and antivirus tools often agree.
- Every fix meant a new file. Change one line, rebuild, send it round again, and hope everyone deleted the old one. I never knew who was running which version.
- When it broke, I was blind. A failure on someone else's laptop meant a screenshot of an error dialog, if I was lucky.
- It only ran where it was built. A Windows .exe, tied to how each person's machine and mail client were set up.
- People expect web apps now. Nobody wants to download a program to do one task. They want a link.
The automation was fine. What failed was how it reached people.
Why I built Callables
That gap, between "the script works on my machine" and "my team can use it", is why I built Callables.
You write a normal Python function. Callables turns it into a web form your team opens from a link, with run history, logs you can actually read and permissions for who can run what. There's nothing to install and nothing to send round: push a change and everyone has it.
The part that would have saved me back then is connections. You register an OAuth app with Microsoft (or Google, Slack, any OAuth service), and declare in code which account a function uses. Each person who runs it signs in once with their own account and approves what it asks for. After that, every run they start works on their own mailbox, and nobody, including you, ever handles their password or token. More on how that works in how to share a Python script that runs as each user.
The same automation, rebuilt
While I wrote this post, an AI coding agent rebuilt that old automation as a callable. It's in the Callables cookbook as Export attachments by thread.
The connection is declared once, next to the other Outlook automations:
from callables import Connection, Group, Secret
outlook = Connection(
"outlook",
provider="microsoft",
scopes=["Mail.ReadWrite", "Mail.Send", "User.Read"],
client_id=Secret("MS_CLIENT_ID"),
client_secret=Secret("MS_CLIENT_SECRET"),
values={"tenant": Secret("MS_TENANT_ID")},
)
mail = Group("outlook", title="Outlook", connections=[outlook])And the automation is one function. Here it is, trimmed down:
@mail.deploy(title="Export attachments by thread", timeout=900)
def export_attachments(count: int = 50, max_name_length: int = 80) -> list[File]:
"""The attachments from your newest inbox emails, as a zip per thread named after the thread's subject."""
client = Graph(outlook.token) # the token of whoever is running it
messages = client.messages(INBOX, ..., count)
files = []
for emails in by_thread(messages).values():
name = clean_name(thread_subject(emails[0].subject), max_name_length, "No subject")
with zipfile.ZipFile(path, "w") as zf:
for message, raw in zip(emails, client.mimes([m.id for m in emails])):
for file_name, data in attachments(parser.parsebytes(raw), max_name_length):
zf.writestr(file_name, data)
files.append(File(path, name=f"{name}.zip"))
return filesWhat each piece replaces from the old version:
- The function's arguments are the form.
countandmax_name_lengthbecome two number fields with their defaults filled in. That's the whole tkinter UI. outlook.tokenis the person running it. When a coworker opens it for the first time, they're asked to connect their Microsoft account. Their runs see their mailbox, mine see mine.- Returning
list[File]gives them downloads. Each thread comes back as its own zip, named after the subject with theRE:andFwd:stripped off.
The full version handles what the old one never did: characters that can't go in a file name, very long subjects, two threads with the same subject, and the same file attached again further down a thread.
From push to shared
With the project connected to GitHub, deploying is pushing. By the time I'd finished writing the LinkedIn post about this, the project was built on Callables and ready to share with my team.
Sharing it is a link. Teammates open it in the browser, connect their Outlook once, and run it. If I fix something, I push, and the next run uses the new version. If someone's run fails, I can see what happened in its logs instead of waiting for a screenshot. And I can control who can run what without sending anyone a file.
Try it yourself
The cookbook is one Callables project with working automations for Outlook and Gmail. To run this one:
- Register a Microsoft app by following the Microsoft connector guide, with the delegated permissions
Mail.ReadWrite,Mail.SendandUser.Read. - Fork the cookbook, create a project from it on Callables, and set
MS_CLIENT_ID,MS_CLIENT_SECRETandMS_TENANT_IDin its secrets. - Open Export attachments by thread, connect your Microsoft account, and run it.
Or try it on your own machine first. With the same three values in a .env file:
git clone https://github.com/callables-app/callables-cookbook && cd callables-cookbook
pip install callables -r requirements.txt
call connect outlook
call outlook export_attachments --count 50What's yours?
Most automations that never get used aren't hard to write. They're hard to reach: the person who needs it can't run a script, and the data it needs is in their account, not yours.
What automation are you putting off because there's no clear way for the people who need it to run it?
Turn your scripts into tools your team can run
Add @deploy to a Python function and push. Your team gets a form, schedules and run history.
Keep reading
How to share a Python script that runs as each user
Some scripts should use a shared company key. Others should act as the person running them, on their own inbox or calendar. How to build and share the second kind without handling anyone's password or token.
GuidesHow to share Python scripts with non-technical teammates
Your script works, and now someone in ops needs to run it without a terminal. The usual options, what each one costs, and how to get a script ready for other people.
GuidesBuild automations with Claude Code, Cursor and other AI agents
One command teaches your coding agent how to write Callables functions, check them and run them locally. Then you push.
