Skip to main content

Lightweight persistent job scheduler for Python

Project description

whenly

PyPI version Python versions License: MIT

Lightweight persistent job scheduler for Python — SQLite-backed, minimal dependencies.

from whenly import Scheduler

s = Scheduler()

@s.every(5, "minutes")
def sync_data():
    ...

@s.cron("0 9 * * MON")
def weekly_report():
    ...

s.start()  # background thread

Features

  • SQLite persistence — jobs survive restarts
  • Cron expressions via croniter
  • Interval scheduling — every N seconds/minutes/hours
  • One-off delayed jobs — run once after a delay
  • Decorator or programmatic API
  • Thread-safe background runner
  • CLI for basic management
  • Zero external dependencies (except croniter for cron support)

Install

pip install whenly

Quick Start

from whenly import Scheduler

s = Scheduler()

# Interval jobs
@s.every(30, "seconds")
def poll_api():
    print("Polling...")

# Cron jobs
@s.cron("0 */2 * * *")
def cleanup():
    print("Running cleanup...")

# One-off delayed job
@s.later(10, "minutes")
def send_notification():
    print("Hello!")

# Or pass a function directly
s.later(30, "seconds", func=poll_api)

# Start the scheduler (non-blocking)
s.start()

# Or run blocking
# s.run()

Programmatic API

s.add(poll_api, every="60s")
s.add(cleanup, cron="0 3 * * *")
s.remove_job("poll")
s.list_jobs()

CLI

whenly list
whenly run

License

MIT


Part of the thecliffhanger open source suite.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whenly-0.3.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whenly-0.3.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file whenly-0.3.0.tar.gz.

File metadata

  • Download URL: whenly-0.3.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for whenly-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9ba4ed5342058ed0a5842ed2151b9f543950507caeb9c552b2aafc19ac247c99
MD5 12408a5b8d1fdf9aa7a06e978363909d
BLAKE2b-256 1492e3407acf86c1422c67d83672b6dccff740915436beddf91502e0b76ddb7f

See more details on using hashes here.

File details

Details for the file whenly-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: whenly-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for whenly-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8d7d42b34e1c7273da42081b1e5f8d822a711731112db9dbef97ee1168b46481
MD5 b85359ee85f626a308198cdeb55a86f4
BLAKE2b-256 5242c0137438cef69d9c42da9f163d5a7753b1595441e78558d110c6b3fa8a83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page