Skip to main content

Dramatiq Crontab

dramtiq-crontab logo: person in front of a schedule

Cron style scheduler for asynchronous Dramatiq tasks in Django.

  • setup recurring tasks via crontab syntax
  • lightweight helpers build on robust tools like Dramatiq and APScheduler
  • Sentry cron monitor support

PyPi Version Test Coverage GitHub License

Setup

You need to have Dramatiq installed and setup properly.

python3 -m pip install dramatiq-crontab
# or
python3 -m pip install 'dramatiq-crontab[sentry]'  # with sentry cron monitor support

Add dramatiq_crontab to your INSTALLED_APPS in settings.py:

# settings.py
INSTALLED_APPS = [
    "dramatiq_crontab",
    # ...
]

Finally, launch the scheduler in a separate process:

python3 manage.py crontab

Setup Redis as a lock backend (optional)

If you use Redis as a broker, you can use Redis as a lock backend as well. The lock backend is used to prevent multiple instances of the scheduler from running at the same time. This is important if you have multiple instances of your application running.

Install the Redis extra, or combine it with Sentry support:

python3 -m pip install 'dramatiq-crontab[redis]'
# or
python3 -m pip install 'dramatiq-crontab[redis,sentry]'

Then configure the Redis URL:

# settings.py
DRAMATIQ_CRONTAB = {
    "REDIS_URL": "redis://localhost:6379/0",
}

Usage

# tasks.py
import dramatiq
from dramatiq_crontab import cron


@cron("*/5 * * * *")  # every 5 minutes
@dramatiq.actor
def my_task():
    my_task.logger.info("Hello World")

Interval

If you want to run a task more frequently than once a minute, you can use the interval decorator.

# tasks.py
import dramatiq
from dramatiq_crontab import interval


@interval(seconds=30)
@dramatiq.actor
def my_task():
    my_task.logger.info("Hello World")

Please note that the interval is relative to the time the scheduler is started. For example, if you start the scheduler at 12:00:00, the first run will be at 12:00:30. However, if you restart the scheduler at 12:00:15, the first run will be at 12:00:45.

Sentry Cron Monitors

If you use Sentry you can add cron monitors to your tasks. The monitor's slug will be the actor's name. Like my_task in the example above.

The crontab command

$ python3 manage.py crontab --help
usage: manage.py crontab [-h] [--no-task-loading] [--no-heartbeat] [--version] [-v {0,1,2,3}]
                         [--settings SETTINGS] [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                         [--force-color] [--skip-checks]

Run dramatiq task scheduler for all tasks with the `cron` decorator.

options:
  -h, --help            show this help message and exit
  --no-task-loading     Don't load tasks from installed apps.
  --no-heartbeat        Don't start the heartbeat actor.

Metadata

Release files for dramatiq-crontab 1.2.1

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

Source distribution (sdist)

Source distribution for dramatiq-crontab 1.2.1
File Size Uploaded Provenance Actions
dramatiq_crontab-1.2.1.tar.gz 8.4 kB With provenance Details for dramatiq_crontab-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dramatiq-crontab 1.2.1
File Interpreter ABI Platform Actions
dramatiq_crontab-1.2.1-py3-none-any.whl Python 3 none any Details for dramatiq_crontab-1.2.1-py3-none-any.whl

Total release size: 17.3 kB

Release files / dramatiq_crontab-1.2.1.tar.gz

Download URL dramatiq_crontab-1.2.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6f3b96cd04af2beeddc3cc7f1d3dc303c9b452fe0760d14e132436801ee79320
BLAKE2b-256 checksum
How to use checksums
84cd5d766cb58d9166e0513050e072ec05e0a9b5921d84476538de0af19ad11f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Release files / dramatiq_crontab-1.2.1-py3-none-any.whl

Download URL dramatiq_crontab-1.2.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd1bb0eb95156f248bd73d65056ce39f43a5615f4029d7056381f3845081e132
BLAKE2b-256 checksum
How to use checksums
27c95f8cbd88b36bb413ce6e377e7e5545333d8aa73a889df61de6bd827a4fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 26, 2026.

Transparency log

Security for dramatiq-crontab 1.2.1

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 dramatiq_crontab-1.2.1.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 Oct 26, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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