Skip to main content

gpscheduler

PyPI version Python License: MIT Documentation

GPScheduler (General-Purpose Scheduler) is a cron-style Python scheduler that turns functions from any package into scheduled jobs via config files, configures startup arguments, and exposes a decorator to mark schedulable functions.

中文文档:README.zh.md


Features

  • Config-driven cron jobs — declare schedules, callables, and call arguments in YAML config files; no timers hardcoded in application code.
  • Package-agnostic — point a job at any importable function in any installed package, located by dotted path.
  • Two decorators — @scheduled marks a function as schedulable; @worker_init builds an expensive object (DB connection, network client, …) once and reuses it across runs.
  • Thread and process executors — each job picks its own pool. Threads for I/O-bound work, processes for CPU-bound or isolated work.
  • Scheduler-wide globals — shared config values (db_url, api_key, …) injected into every job that asks for them.
  • Graceful, cross-platform shutdown — Ctrl+C on Windows, SIGINT/SIGTERM on Linux, with a configurable shutdown timeout.
  • Fail-Early validation — invalid config fails loudly at load time, never silently at the first trigger.
  • Embeddable — run standalone via the CLI, or embed it inside a host application.

Installation

pip install gpscheduler

For local development from a clone:

source .venv/Scripts/activate   # Git Bash on Windows
pip install -e ".[dev]"

Quick start

  1. Install gpscheduler (see Installation).

  2. Write a package containing a @scheduled function:

    # myjobs/hello.py
    from gpscheduler import scheduled
    
    @scheduled
    def greet(name: str, *, greeting: str = "Hello") -> None:
        print(f"{greeting}, {name}!")
    
  3. Point a config folder at it:

    # configs/scheduler.yaml
    cfg_class_name: GPSchedulerConfig
    configured_class_name: GPScheduler
    executor: thread
    packages: [myjobs]
    
    # configs/jobs/hello.yaml
    cfg_class_name: GPJobConfig
    func: "myjobs.hello.greet"
    cron: "*/2 * * * * *"   # every 2 seconds (6-segment, leading seconds field)
    args: ["world"]
    kwargs:
      greeting: "Hi"
    

    The config folder also needs a global_env.yaml (required by the underlying gpconfig loader) — an empty {} is fine.

  4. Run it:

    gpscheduler run --config configs
    

    Use gpscheduler list-jobs --config configs for a dry run that validates config and lists enabled jobs without starting anything.

See the Examples page in the docs for a complete, annotated demo covering arguments, job_globals injection, worker_init in both thread and process pools, and more.

Documentation

Full documentation is published at https://linnetcodes.github.io/gpscheduler/ (English / 简体中文).

License

MIT © LinnetCodes

Metadata

Release files for gpscheduler 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpscheduler 0.1.0
File Size Uploaded Provenance
gpscheduler-0.1.0.tar.gz 108.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gpscheduler 0.1.0
File Interpreter ABI Platform
gpscheduler-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 139.6 kB

Release files / gpscheduler-0.1.0.tar.gz

Download URL gpscheduler-0.1.0.tar.gz
Size 108.3 kB
Tags Source
SHA-256 checksum
How to use checksums
72dc056b11b07a7dd4944347cce81a179c2013deae18baa51452c23f97dd2a4b
BLAKE2b-256 checksum
How to use checksums
c54c2a2ed28fff1227d2bd9a65e5c909b6b39c91baf9be9dc1521a290e16cce3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Release files / gpscheduler-0.1.0-py3-none-any.whl

Download URL gpscheduler-0.1.0-py3-none-any.whl
Size 31.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f64ba8c71cd3942812c4840b78b2534e905d8c3cde87b9608dfd3b88d682cbd
BLAKE2b-256 checksum
How to use checksums
fd722bbc685ac7bff1ae8223b93d15a6abae47bb897f690b9342b7c07e38d48f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

Security for gpscheduler 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gpscheduler-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page