Button guide

Let lab members run your analysis script without installing Python, R or conda a web form on the lab computer

You can put a web form in front of your Python or R script using Button (https://button.bitgate.dev), so the script runs on the one lab computer where your environment is already working and lab members just upload their files through a browser. The Free plan ($0) covers 1 published tool, 3 people and 100 runs per month, and individual runs can go for up to 30 minutes with files up to 25 MB each.

The conda problem on lab laptops

Keeping conda environments working across a whole lab is a bad use of your time. And it never really stays fixed anyway, because someone gets a new laptop, or updates a package, and then you get version drift between members where the same script gives slightly different results or just crashes on one person's machine.

If you have one lab workstation or your own computer where the environment is already set up and working, it's much simpler to keep the code there. With Button, that computer runs the job. Lab members open a link, upload their data, set their parameters, press Run and download the output files when it's done. They don't install Python, R, conda or anything else, and they never pay.

How Button works for a lab script

Button's runner sits on your lab computer (macOS, Linux or Windows) and waits for jobs. The jobs run on your computer, never in Button's cloud, while Button's servers relay the form values and files between the member's browser and that computer. Anything you can call from the command line works: Python, R, Node, PowerShell, shell scripts, compiled binaries.

A few things matter when you're sharing a machine with a rotating group of people:

  • The runner only executes the exact command you approved on that computer, 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 change a tool, lab members have to confirm the new version before running it.
  • Every run is logged with who ran it and when.
  • When someone leaves the lab, you can revoke their access or set it to expire ahead of time.

Preparing your script

Before you hook the script up to Button, make sure it takes its inputs as command-line arguments instead of hard-coded paths or interactive prompts. In Python, use argparse; in R, use commandArgs(); in PowerShell, a param() block; in bash, $1 and $2.

Take each input file path as an argument, and write the results as files into an output folder that is also passed as an argument. Fixed flags such as --threshold are part of the command you approve; lab members only supply the values for the form fields.

Here is a minimal Python wrapper with argparse:

import argparse
import os

parser = argparse.ArgumentParser()
parser.add_argument("--input-file", required=True)
parser.add_argument("--threshold", type=float, required=True)
parser.add_argument("--output-dir", required=True)
args = parser.parse_args()

os.makedirs(args.output_dir, exist_ok=True)
# run your analysis here and write files into args.output_dir

And the same thing in R using commandArgs():

args <- commandArgs(trailingOnly = TRUE)
input_file <- args[1]
threshold <- as.numeric(args[2])
output_dir <- args[3]

dir.create(output_dir, showWarnings = FALSE, recursive = TRUE)
# run your analysis here and write files into output_dir

Setting it up on the lab computer

  1. Sign in at https://button.bitgate.dev.
  2. Install the Button runner on the lab computer with the one-line command the site shows you (it uses curl on macOS and Linux, or PowerShell on Windows).
  3. Open the local setup page and pick the program you want to run. Point it at the Python or R executable inside your conda environment so it has all your packages; python -c "import sys; print(sys.executable)" inside the activated environment prints the path.
  4. Describe the script's inputs - text, number, yes/no, choice, files - and publish the tool. Button gives the tool its own page.
  5. Invite your lab members. 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.

Your lab computer has to be on and online for people to use it. Tool pages show Ready, Busy or Offline so people know if someone else's job is currently running or if the machine is asleep.

Limits and when to use a cluster instead

Button is built for quick pipeline runs, not heavy batch processing. If your jobs run for hours or chew through gigabytes of sequencing or imaging data, they belong on a cluster.

Limit or plan detail Free ($0) Pro ($15/month, or $144/year at $12/month)
Published tools 1 50
People (distinct invited colleagues; you don't count) 3 250
Runs per month (includes your own runs) 100 5,000
File transfer per month 1 GB 50 GB
Computers (runners) per workspace 1 1
Max time per run 30 minutes 30 minutes
Max file size 25 MB each (up to 8 files and 100 MB per run) 25 MB each (up to 8 files and 100 MB per run)
Max log size 1 MB per run 1 MB per run
Concurrent runs per computer 1 at a time 1 at a time
File retention Inputs deleted after 24 hours, outputs after 7 days Inputs deleted after 24 hours, outputs after 7 days

Every plan gives you one computer (runner) per workspace, and pairing a new computer replaces the previous one. Recipients never pay, and downgrading from Pro to Free deletes nothing.

Alternatives: JupyterHub and Script Server

Sometimes a web form hooked up to one workstation isn't what you need.

If lab members need to write or edit code, inspect plots interactively, or explore their data step by step, use JupyterHub. It's a multi-user notebook server you host for a team, class or lab, and it gives everyone per-user workspaces so you can still manage the environment centrally without locking them into a fixed form.

If you want a web form for scripts like Button provides, but you already maintain a Linux server and want to host the whole thing yourself for free, look at Script Server (github.com/bugy/script-server). It's a free, open source Python web server you install and host yourself (Linux, or Docker). Like Button, script parameters become form fields, including file uploads, and it shows live output, offers output files for download, supports LDAP, Google OAuth and htpasswd logins, and keeps execution history. Its last tagged release is from August 2023, though the main branch still gets commits. If you're comfortable hosting a web server and handling login setup yourself, Script Server is a solid option.

FAQ

Where do the jobs and files actually go?

The script itself runs on your computer, never in Button's cloud. However, form values and uploaded or downloaded files do pass through Button's servers to get between the member's browser and your computer, and Button deletes inputs 24 hours after a run ends and outputs after 7 days.

Can two lab members run the script at the same time?

No, a computer runs one job at a time. While a run is going, the tool page shows Busy to everyone else until it finishes.

What happens when I change the tool?

Lab members have to confirm the new version before their next run. The runner only executes the exact command you approved on the lab computer, pinned by hash.

Can we connect two different lab workstations to our workspace?

Not in the same workspace. Every plan allows one computer (runner) per workspace, and pairing a new computer replaces the previous one.

Can someone pass extra flags to my script through a text field?

No. Every form value is passed to your program as its own argument with no shell, and Button blocks any form value that starts with "-".

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.