A lightweight Python utility that simplifies defining Celery Beat schedules using a clean, declarative function-based API.
Project description
celery-simple-schedule
A lightweight Python utility that simplifies defining Celery Beat schedules using a clean, declarative function-based API.
Just return a list of (task_path, schedule, optional_args) tuples — and get a fully compatible CELERY_BEAT_SCHEDULE dictionary.
Installation
pip install celery-simple-schedule
Usage
- Define your task schedule in a separate module, e.g. celery_tasks.py::
from celery_simple_schedule import simplify_schedules
from datetime import timedelta
from celery.schedules import crontab
@simplify_schedules
def provide_tasks():
"""
Pattern: (task_dir, schedule, args(optionally))
"""
return (
('server.apps.math_news.tasks.create_news_task', timedelta(days=1)),
('server.apps.notifications.tasks.clear_expired_deleted_notifications', timedelta(days=3)),
('server.apps.todo_list.tasks.create_default_task', timedelta(days=5), (5, '1', True)),
)
- Wire it into your Celery app (celery.py):
from celery import Celery
from server.apps.celery_tasks import provide_tasks
app = Celery('my_project', broker=broker)
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
app.conf.beat_schedule = provide_tasks() # 🧠 This is the magic
And that's it! You now have a clean and maintainable way to manage your periodic task schedule — with zero boilerplate and maximum clarity.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file celery_simple_schedule-0.2.1.tar.gz.
File metadata
- Download URL: celery_simple_schedule-0.2.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e42db6aafb238500377134cada8ff0371d843ded2e3d823e00057741f667369
|
|
| MD5 |
9185c593cacc4ef099e6a38e64bec98a
|
|
| BLAKE2b-256 |
0375b62113199972e016ac15e7843f3a293a63b6998a668a5138559571c186d1
|
File details
Details for the file celery_simple_schedule-0.2.1-py3-none-any.whl.
File metadata
- Download URL: celery_simple_schedule-0.2.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
917b7b56561247f94f9b674afc5af2dd18ab47bbab9185c322fe36748ca27be1
|
|
| MD5 |
2ce45a6a632d10a5b1f99c3ebd06b1be
|
|
| BLAKE2b-256 |
14d7b281b202c1626408c7ab0cc4c94cb56cb22f11b659d867c8fcf54321b07d
|