How to Run Python on iPhone: On-Device Apps vs Running in the Cloud

Disclosure: I build Pocket Actions, which doesn't run Python itself — it triggers GitHub Actions workflows (which can run Python) from an iPhone. I included it because "run my Python script from my phone" is often really a cloud job. App details come from current US App Store listings (linked) as of the last-checked date; anything not stated there is marked unconfirmed.

Two different questions

"Run Python on iPhone" usually means one of two things:

  1. Write and run code on the phone itself — learning, quick calculations, notebooks, scripts that touch your photos or clipboard.
  2. Kick off a script you already have — a scraper, a report, an AI call — and you just want a button on your phone. The code doesn't need to run on the phone; it needs to run somewhere and keep running if you lock the screen.

On-device apps are great at (1). For (2), a cloud runner triggered from the phone is often the better fit. Here are both.

On-device Python apps

All facts below are from each app's US App Store description.

On-device Python apps
AppPricePythonHighlights from the listing
Pythonista 3$9.993.10requests, numpy, matplotlib, pandas included; iOS modules for sensors, photos, contacts, reminders, clipboard; app extensions for iOS automation
Pyto IDEFree to download (in-app purchases unconfirmed)3.10100+ third-party packages, C/C++ compiler, terminal, debugger, Shortcuts support
a-ShellFreeIncluded (version unconfirmed)Local Unix terminal; Python, Lua, Perl, JS, C/C++; git; controllable from Shortcuts
Carnets – JupyterFreeEmbeddedJupyter notebooks fully offline; %pip install for pure-Python packages
JunoFree; running code needs a one-time Pro purchase after a trial (price unconfirmed)3.13Notebooks, scripts, REPL offline; NumPy, pandas, scikit-learn, etc.; Shortcuts/Siri App Intents; background execution of long scripts

Notes on each

Pythonista 3 — the long-standing choice for iOS automation in Python, with modules that reach into iOS features. Paid up front. Its listing says Python 3.10.

Pyto — a free-to-download IDE with a broad package set and even a C/C++ compiler. Supports Shortcuts.

a-Shell — a terminal rather than an IDE. Good if you think in shell commands and want to script it from Shortcuts.

Carnets — the simplest way to get Jupyter notebooks on an iPhone, offline. Only pure-Python packages can be added.

Juno — the most modern Python version of the group (3.13) and a data-science stack. Editing is free; running code is the Pro feature after a trial.

Limits that apply to all on-device options

  • Package installs: native-extension packages that aren't bundled generally can't be added (Carnets and Juno explicitly say pure-Python only for installs).
  • Battery and screen: long jobs depend on the app being allowed to run; Juno advertises background execution, others' behavior is unconfirmed.
  • Scheduling: running at 3 a.m. while the phone is in your pocket is not what these apps are designed for.

Running Python in the cloud, triggered from the phone

If your script already works on your laptop, another route is to put it in a GitHub repository and run it on a GitHub-hosted runner, using the official actions/setup-python action to pick a Python version.

on:
  workflow_dispatch:
    inputs:
      ticker:
        type: string
        required: true
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.12" }
      - run: pip install -r requirements.txt
      - run: python main.py "${{ inputs.ticker }}"

Cost (GitHub Actions billing): standard GitHub-hosted runners are free in public repositories. For private repositories, GitHub Free includes $12 of compute per month; a standard Linux runner costs $0.006 per minute, so a 2-minute script uses about $0.012.

Pros: any pip package, real CPU, runs to completion with your phone locked, secrets stored as repository secrets instead of on the phone, and you can also put it on a schedule. Cons: you need a GitHub repo and a workflow file; startup takes longer than tapping Run in a local app; output lives in GitHub's logs, not in a notebook on your phone.

Ways to start that workflow from an iPhone

  • GitHub Mobile — run workflow_dispatch workflows and read logs (changelog).
  • iOS Shortcuts — POST to the workflow dispatch API (how-to).
  • Pocket Actions — 1–3 taps, input form built from your inputs. Limits: always runs on main, no logs in the app (check results in GitHub), iOS only, free for 5 runs/day and 17/week; Premium $2.99/mo or $49.99 lifetime.

Google Apps Script is a third cloud option but runs JavaScript, not Python.

From laptop script to phone button: a full walkthrough

If the cloud route sounds right, here is the whole path, using a small script as the example. Nothing here depends on a particular phone app until the last step.

1. Make the script take arguments and read secrets from the environment

# main.py
import argparse, os, sys, json, urllib.request

def main():
    p = argparse.ArgumentParser()
    p.add_argument("ticker")
    p.add_argument("--days", type=int, default=30)
    args = p.parse_args()

    api_key = os.environ.get("API_KEY")
    if not api_key:
        sys.exit("API_KEY is not set")   # fail loudly so the run shows red

    # ... your real work here ...
    result = {"ticker": args.ticker, "days": args.days, "status": "ok"}

    # Write a Markdown summary that shows up on the run page
    summary = os.environ.get("GITHUB_STEP_SUMMARY")
    if summary:
        with open(summary, "a") as f:
            f.write(f"## {args.ticker}\n\n```json\n{json.dumps(result, indent=2)}\n```\n")
    print(json.dumps(result))

if __name__ == "__main__":
    main()

Three habits make a script phone-friendly:

  • Arguments instead of editing the file. Whatever you'd change between runs becomes an argument, and then a workflow input.
  • Secrets from environment variables. The key goes into GitHub's secret store, not into the code or onto the phone.
  • Exit with an error when something's wrong. A non-zero exit code marks the run as failed, and GitHub notifies you. A script that prints "error" and exits 0 looks like a success.

2. Pin dependencies

# requirements.txt
requests==2.32.3
pandas==2.2.3

Pin exact versions so a run next month uses the same packages as today. (These versions are just an example. Use whatever you tested with.)

3. The workflow, with caching and typed inputs

# .github/workflows/run.yml
name: Run script
on:
  workflow_dispatch:
    inputs:
      ticker:
        description: "Symbol"
        type: string
        required: true
      days:
        description: "Lookback days"
        type: choice
        options: ["7", "30", "90"]
        default: "30"
jobs:
  run:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
          cache: pip
      - run: pip install -r requirements.txt
      - run: python main.py "$TICKER" --days "$DAYS"
        env:
          TICKER: ${{ inputs.ticker }}
          DAYS: ${{ inputs.days }}
          API_KEY: ${{ secrets.API_KEY }}

Details worth copying:

  • cache: pip in setup-python reuses downloaded packages between runs, which shortens startup (setup-python caching).
  • Inputs passed through env, not pasted straight into the shell command. GitHub's security guidance warns that ${{ }} expressions inside run: can be used for script injection; going through an environment variable avoids that (security hardening).
  • type: choice for values with a fixed set, so you tap instead of type.
  • timeout-minutes so a stuck script doesn't run for hours.

4. Add the secret

Repository → Settings → Secrets and variables → Actions → New repository secret → name API_KEY (using secrets). Secrets are masked in logs.

5. Run it once from a computer

gh workflow run run.yml -f ticker=AAPL -f days=30
gh run watch

gh workflow run dispatches the workflow and gh run watch follows the latest run (gh workflow run). Fix anything that fails here before moving to the phone.

6. Put it on the phone

Pick one of the three starters above. With GitHub Mobile, open the workflow and tap Run workflow. With Shortcuts, POST to the dispatch endpoint with {"ref":"main","inputs":{"ticker":"AAPL","days":"30"}}. With Pocket Actions, select the workflow; ticker appears as a text field and days as a picker. The result is on the run page in GitHub, where the step summary shows the JSON block.

Problems you'll likely hit

Problems you'll likely hit
SymptomCauseFix
ModuleNotFoundErrorPackage missing from requirements.txtAdd it; on your laptop, pip freeze shows what you actually use
A package fails to build on the runnerNeeds system librariesAdd an apt-get install step before pip, or pick a version with prebuilt wheels
API_KEY is not setSecret name mismatch, or workflow triggered from a forkCheck the name exactly; secrets aren't passed to workflows from forks
Works locally, wrong output in ActionsDifferent time zone (runners use UTC) or localeSet TZ in env, or handle time zones in code
Run takes much longer than locallyFresh machine each time: setup plus installUse cache: pip; keep dependencies lean
On-device app can't install a packageNative extension not bundledUse a bundled package or run in the cloud

On-device or cloud: a quick checklist

Run it on the phone if most of these are true: it's short, it uses only bundled or pure-Python packages, it needs iOS data (photos, clipboard, sensors), it has no secrets worth protecting, and you want the output right there.

Run it in the cloud if most of these are true: it needs heavy or native packages, it holds an API key, it should finish even if you lock the phone, it might also run on a schedule, or you want a run history.

Many people end up using both: a notebook app for experiments, and a workflow for the scripts that turned into routines.

The move between the two is usually smooth: once a notebook experiment works, wrap its core in a function, turn the values you keep changing into arguments, and you have the main.py from step 1. From then on, the phone holds only the button, and the code, secrets and history live in the repository.

What a cloud run costs, worked through

Take the example workflow above in a private repository on a standard Linux runner (billing docs):

  • Setup (checkout, Python, cached pip install): call it about 1 minute. This varies with your dependencies, so measure yours on the run page.
  • The script itself: say 1 minute.
  • About 2 minutes per run × $0.006 per minute ≈ $0.012 per run.
  • GitHub Free includes $12 of compute per month, so even 10 runs a day (about 300 a month, roughly $3.60) stays inside the included amount, assuming nothing else uses it.

In a public repository, standard runners are free, but your code and logs are public too. Don't print secrets or private data. Secrets are masked in logs, but what your script prints about its results isn't.

Reading results on the phone

Because the run happens in GitHub, results show up there rather than in the app that started it:

  • Step summary: the Markdown your script writes to $GITHUB_STEP_SUMMARY appears at the top of the run page, which is easier to read on a phone than raw logs.
  • Artifacts: files uploaded with actions/upload-artifact can be downloaded from the run page (storing artifacts).
  • Notifications: a final step can send the result to chat or email, so it reaches you without opening GitHub at all.

Which should you choose?

  • Learning or experimenting on the phone: Pyto, Carnets or Juno (free to start).
  • Python that touches iOS (photos, clipboard, sensors): Pythonista 3.
  • Shell-style scripting from Shortcuts: a-Shell.
  • Data notebooks offline: Carnets or Juno.
  • An existing script that needs heavy packages, secrets, or to keep running: run it on GitHub Actions and trigger it from GitHub Mobile, a Shortcut, or Pocket Actions.

A real example

I have a workflow that asks AI to evaluate stocks I'm curious about. It runs on GitHub Actions, and I start it from my phone with Pocket Actions only when I want a result.

Try it

If your Python already lives in a GitHub repo, you can trigger it from iPhone free (5 runs a day).

View Pocket Actions on the App Store

FAQ

Can I run Python on an iPhone for free? Yes. Pyto, a-Shell and Carnets are free to download per their listings. Juno is free to edit, with code execution unlocked by a one-time purchase after a trial.

What's a good Pythonista alternative? Pyto (IDE with many packages), Juno (Python 3.13, notebooks), Carnets (Jupyter), or a-Shell (terminal). Pythonista remains distinctive for its iOS integration modules.

Can I pip install packages on iPhone? Partly. Carnets and Juno allow installing pure-Python packages; packages with native extensions generally need to be bundled with the app.

Can I run a Python script on a schedule from iPhone? Not reliably on-device. Run it on GitHub Actions with a schedule or trigger it manually from your phone.

Does Pocket Actions run Python? Not on the phone. It triggers a GitHub Actions workflow, and the workflow runs your Python on GitHub's runner.

Last checked: 2026-11-01 (US App Store listings; GitHub Actions billing docs; actions/setup-python).