Blog
Guides

How to schedule a Python script without a server

DK
Dan Kowalsky
Founder ·

Cron works well until you realize the script only runs while your laptop is open, or you're paying for a server that does five minutes of work a day. If all you need is "run this Python every morning", you don't need a machine of your own at all. Here are the options, from free and fiddly to managed.

The options at a glance

OptionSetupSecretsWhen a run failsGood for
GitHub ActionsA YAML file in the repoRepo secretsWorkflow logs, email to youDevelopers who live in GitHub
AWS Lambda + EventBridgeFunction, IAM role, schedule ruleEnvironment or Secrets ManagerCloudWatch logs and alarmsTeams already on AWS
Google Cloud Run jobs + Cloud SchedulerContainer, job, scheduler entrySecret ManagerCloud LoggingTeams already on Google Cloud
PythonAnywhere scheduled tasksUpload the script, pick a timeEnvironment in the script setupA log file per taskA single hobby script
CallablesA decorator, then pushSet in the web appEvery run saved with logs and resultScripts a team also runs by hand

GitHub Actions

If the script is already in a GitHub repo, a workflow file is the quickest free option:

name: Morning report
on:
  schedule:
    - cron: "0 13 * * 1-5" # 13:00 UTC = 9am New York in summer
  workflow_dispatch:

jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - run: pip install -r requirements.txt
      - run: python report.py
        env:
          API_KEY: ${{ secrets.API_KEY }}

The catches: schedules are in UTC only, so daylight saving time shifts your local run time; runs can start late at busy times; scheduled workflows in public repos switch off after 60 days with no activity; and anyone who needs to see the output or start a run needs access to the repo. It's built for CI, so it's fine for a developer's own job and awkward for something the finance team relies on.

Cloud functions with a scheduler

The big clouds can run code on a timer without a server you manage:

  • AWS: put the script in a Lambda function and trigger it with an EventBridge Scheduler schedule. Lambda runs stop at 15 minutes.
  • Google Cloud: package the script as a Cloud Run job and trigger it from Cloud Scheduler. Jobs can run for much longer than a request.
  • Azure: a timer-triggered Azure Function does the same.

These scale to anything and cost very little for a daily job. The cost is setup: packaging dependencies, permissions, a secrets service, and logs in a console your teammates won't open. Worth it if you're already deep in that cloud; heavy for one script.

PythonAnywhere

PythonAnywhere is a hosted Python environment with a Tasks page: upload your script, choose a daily or hourly time, and it runs. It's the simplest of the lot for a single personal script, and there's a free tier with limits on how many tasks you can have. It isn't designed for teams: there's no form for someone else to run the script with their own inputs, and each task's output goes to a log file.

Callables

Callables runs Python functions on a schedule with nothing to host. Write the job as a function with a default for every input:

from callables import deploy


@deploy(title="Morning report", secrets=["API_KEY"])
def morning_report(days: int = 1) -> str:
    """Yesterday's numbers as a short summary."""
    ...

Push the repo, open the function, and click Schedule…: every day, every weekday, every hour or any cron expression, in your own time zone, so 9am stays 9am when the clocks change. Or declare it in code with schedule="0 9 * * 1-5" (UTC).

What you get over the other options:

  • Every run is kept, with its inputs, logs and result, in a history the whole team can read.
  • Secrets stay out of the code and are never shown to the people running the function. See keeping API keys out of scripts.
  • The schedule is also a form. Anyone you share the function with can run it by hand with different inputs, without touching a terminal or the repo.
  • You pay for the seconds it runs, not for a server that sits idle. We wrote up moving a real pipeline off a VPS in stop paying for an idle server.

Runs last up to 2 hours on Pro (30 minutes on Hobby), so multi-hour batch jobs belong on Cloud Run or an orchestrator instead.

Which to choose

  • One personal script, free: GitHub Actions, or PythonAnywhere if the code isn't on GitHub.
  • Already all-in on a cloud: Lambda or Cloud Run with its scheduler.
  • A job your team depends on, or also runs by hand: Callables.

For cron, Windows Task Scheduler and the rest of the methods side by side, see how to run a Python script on a schedule.

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.

See how it works

Keep reading