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.disable("poll")
s.enable("poll")
s.run_now("poll_api")
print(s.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.4.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.4.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: whenly-0.4.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.4.0.tar.gz
Algorithm Hash digest
SHA256 500ee7530c38f40a02ee3976f0000c9b716de53fa9733917bf23f05ee193c19e
MD5 fe8c4e0bafcbafd764ced57b1daacee2
BLAKE2b-256 3dda7479ed1b13b3944c81046982e8ecd7257b92f4149a3d3f231dc305f3bf03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: whenly-0.4.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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d745cfb9279e60aa4984ba9569db96adb18065058d346e475a1ec0ba48f87e7b
MD5 074c29965d647b8658d2ba3389b662df
BLAKE2b-256 20cf9e1b4d68f501551b8eb96c3c4dc10f2fa4e3ab7cbfd55ffd7ed1689992a2

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