Button guide
PyScript or a real computer? Running Python from a web page: what works inside the browser and what needs a machine
You can run Python inside a web browser with PyScript and Pyodide when your script is self-contained, pure-Python logic, and doesn't need local programs or internal databases. When the script does need your real environment, C-extension packages that aren't built for Pyodide, or network resources, Button (https://button.bitgate.dev) lets you put a web form in front of the script on your own computer for $0 on the Free plan (up to 100 runs per month) or $15/month on Pro (up to 5,000 runs per month).
What PyScript and Pyodide actually do
If you've heard that you can put a Python script on a static web page and skip the server altogether, that's PyScript. Under the hood, PyScript runs Python right inside the user's browser tab using either Pyodide (which is CPython compiled to WebAssembly) or MicroPython, so there is no server-side Python at all.
When does this make sense? If you're building interactive demos, teaching Python, or sharing a self-contained calculation where the logic is pure Python, PyScript is the better choice. You don't need to keep a computer running, and anyone who opens the page runs the code using their own browser's memory and CPU.
The walls show up fast when you try to use it for a work script you already run on your machine:
- Packages: You can only import pure-Python wheels, or C-extension packages that have been specifically prebuilt for Pyodide. If your script depends on a C-extension package that isn't built for Pyodide, it won't load.
- No local programs: Browser Python can't start other programs on the computer. If your Python script calls a shell script, a compiled binary, Node, R, or PowerShell, it can't do that from inside a browser tab.
- No internal network access: It can't reach databases on your network the way your own machine does.
- Files: It can only reach files on the user's device if the user selects them through a file picker, or grants explicit permission in recent Chromium browsers.
Running the script on a real computer behind a Button form
When your script needs your real Python environment, local tools, or databases on your network, it has to run on an actual machine. Button turns a script on your own computer into a web form your colleagues can run, without making you rewrite the script for the browser or set up a cloud server.
With Button, jobs run on your computer (macOS, Linux, or Windows), never in Button's cloud. When a colleague fills out the web form and presses Run, Button's servers relay the form values and files between their browser and the Button runner on your computer, your computer runs the script, and the results go back to their browser to download. Your colleagues don't install anything and they never pay.
Because the job runs on your computer, your computer has to be on and online when someone needs to use the tool. The tool's page shows colleagues whether your machine is Ready, Busy, or Offline, and each computer runs one job at a time (up to 30 minutes per run).
What about security when colleagues are triggering runs on your machine? The runner only executes the exact command you approved on that computer, which is pinned by hash. Every form value is passed to your program as its own argument, with no shell, and a value can't start with "-". (If you ever change a tool, people have to confirm the new version before running it.) Every run is logged with who ran it and when, and you can revoke a colleague's access or set it to expire at any time.
What works where
| Requirement or limit | PyScript / Pyodide (in browser) | Button (runs on your computer) |
|---|---|---|
| Where Python runs | Inside the user's browser via WebAssembly (Pyodide) or MicroPython; no server-side Python | On the creator's computer (macOS, Linux, or Windows); form values and files relay through Button's servers |
| Python packages | Pure-Python wheels or packages prebuilt for Pyodide only | Any package installed on your computer |
| Starting other local programs | Cannot start programs on the computer | Works with any program: Python, Node, R, PowerShell, shell scripts, compiled binaries |
| Reaching network databases | Cannot reach databases on your network | Uses your computer's own environment and network access |
| File access and limits | Through the user's file picker, or explicit permission in recent Chromium browsers | Up to 8 files per run, up to 25 MB each, 100 MB total per run; logs up to 1 MB per run |
| Data retention | Stays in the browser tab | Inputs deleted 24 hours after a run ends, outputs deleted after 7 days |
| Machine availability | Runs whenever the web page loads | Creator's computer must be on and online (shows Ready, Busy, or Offline); one run at a time, up to 30 minutes per run |
| Cost and usage limits | Free to run in the browser | Free plan is $0 (1 published tool, 3 invited people, 100 runs/month, 1 GB transfer/month); Pro is $15/month or $144/year (50 tools, 250 people, 5,000 runs/month, 50 GB transfer/month) |
How to put a Python script behind Button
If your script hits PyScript's limits and you want to run it from your computer through Button instead, here is how you set it up.
1. Prepare your script to take command-line arguments
If your script currently uses hard-coded file paths or interactive prompts, change it to take command-line arguments using argparse (or commandArgs() in R, a param() block in PowerShell, or $1 and $2 in bash). Take each input file path as an argument, and write the output files into an output folder that is also passed in as an argument. Fixed flags like --currency are part of the command you approve on your machine, so your colleagues only supply the values for the form fields.
import argparse
import pathlib
parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--currency", required=True)
parser.add_argument("--output-dir", required=True)
args = parser.parse_args()
out_path = pathlib.Path(args.output_dir) / "result.txt"
out_path.write_text(f"Processed {args.input_file} in {args.currency}\n")
2. Install the runner and publish the form
- Sign in at button.bitgate.dev.
- Install the Button runner on your computer using the one-line command the site shows you (it uses
curlon macOS and Linux, and PowerShell on Windows). You get one computer (runner) per workspace on every plan, and pairing a new computer replaces the previous one. - Pick your program in the local setup page that opens on your machine.
- Describe the inputs the form needs - text, number, yes/no, choice, or files - and publish. Button gives the tool its own page.
- Invite your colleagues. They open the link from their invite email, sign in with Google or a one-time email code, fill in the form, press Run, and download the results.
FAQ
Does our data stay only on my computer when using Button?
No. While the job itself runs on your computer and never in Button's cloud, Button's servers relay the form values and files between your colleague's browser and your computer. Button deletes inputs 24 hours after a run ends and deletes outputs after 7 days.
Can colleagues pass extra flags to my script through a Button form?
No. Every form value is passed to your program as its own argument with no shell, and a value cannot start with "-". Also, the runner only executes the exact command you approved on your computer, pinned by hash.
What happens if my computer is asleep or running someone else's job?
Your computer has to be on and online for colleagues to run the tool, and it handles one run at a time. The tool page shows your colleagues whether your computer is Ready, Busy, or Offline.
How does Button count people and runs on the Free and Pro plans?
"People" counts the distinct colleagues you have invited (you don't count), and recipients never pay. Runs per month include your own runs as well as your colleagues' runs, with 100 runs and 1 GB of file transfer per month on Free ($0) and 5,000 runs and 50 GB of file transfer per month on Pro ($15/month, or $144/year at $12/month). If you ever downgrade, it deletes nothing.
Last updated
Put your script behind a form
Button turns a script on your computer into a web form. Colleagues sign in, fill it in, press Run and download the results. Free for 1 tool and 3 people.