Skip to main content

taskferry-django

Django integration for Taskferry.

flowchart BT
    DJ["Django"]
    TPD["taskferry-django"]
    TP["taskferry"]

    DJ --> TPD --> TP

This package supports Django 6.0+ native django.tasks. Django introduced that API in 6.0; this package imports it directly and does not integrate the third-party django-tasks backport. Taskferry does not invent a parallel API. This package supplies a backend for the standard TASKS setting, so your @task code never changes while the engine behind it becomes a configuration choice.

pip install taskferry-django taskferry-procrastinate

Your code never changes

# myapp/tasks.py
from django.tasks import task


@task
def resize_image(image_id: int) -> None: ...
# anywhere
resize_image.enqueue(42)

Settings

TASKS = {"default": {"BACKEND": "taskferry_django.TaskferryBackend"}}

TASKFERRY = {
    "backends": {
        "celery": {"factory": "celery", "app": "myproject.celery:app"},
        "gcp": {
            "factory": "cloudtasks",
            "project": "my-project",
            "location": "us-central1",
            "url": "https://example.run.app/_taskferry/execute",
        },
    },
    "routes": [
        {"kind": "task", "queue": "local-workers", "backend": "celery"},
        {"kind": "task", "queue": "serverless", "backend": "gcp"},
    ],
    "defaults": {"task": "celery"},
}

For Celery, configure broker/result storage on myproject.celery:app itself; the backend name in Taskferry chooses the Celery execution adapter, while Celery chooses its broker and optional result store. Change the queue routes or default to move Django tasks between Celery and Cloud Tasks without changing task code.

With no TASKFERRY setting at all, everything runs locally — a fresh project works immediately and is obviously not production.

Choosing execution and storage

Choose an engine through TASKFERRY.backends and route queues with the usual routes/defaults configuration. Django's native Tasks API is the enqueue interface; it does not include a production queue or durable task store. Provider integrations are separate optional distributions:

pip install taskferry-django taskferry-celery[celery]
# If Redis is your chosen Celery broker and/or result backend:
pip install 'taskferry-celery[redis]'
# If RabbitMQ is your chosen Celery broker:
pip install 'taskferry-celery[rabbitmq]'
# For GCP push delivery:
pip install taskferry-django 'taskferry-cloudtasks[gcp]'

Celery's broker and result backend are configured on the Celery app, independently of Taskferry routing. Redis is optional; Celery can use other supported brokers and result stores, or run without result storage. The rabbitmq extra is an installation alias; Celery includes its AMQP transport. RabbitMQ can also use Celery's transient rpc:// result backend, or pair with a separate database result backend. The Taskferry Celery adapter advertises result retrieval only when app.conf.result_backend is configured. Cloud Tasks is a push queue: it cannot report execution state or persist return values, so persist progress and results in application-owned storage if required.

Taskferry serializes task names and arguments as JSON; pass identifiers or other JSON-safe values, never ORM instances or pickled objects. Cloud Tasks provides time-bounded task-name deduplication when an idempotency key is supplied; Celery does not, so keyed submissions are rejected there. Cloud Tasks and Celery retry through their native engines according to the Taskferry retry policy. Delivery can be duplicated: make task handlers idempotent. Celery revoke is best effort and does not interrupt a running handler; Cloud Tasks does not expose cancellation. Taskferry has no portable progress reporting contract yet. Celery's persisted state can show queued/started/terminal state when configured, but richer progress belongs in application storage.

What else you get

Enqueue after commit. The classic race — a worker reaching a row before the transaction that created it commits — with the classic fix:

from django.db import transaction
from taskferry_django import task_on_commit


def create_order(request):
    with transaction.atomic():
        order = Order.objects.create(...)
        task_on_commit("myapp.tasks:process_order", order.id)

System checks. manage.py check builds every configured backend, because "the adapter is installed" and "the adapter works with these options" are different questions:

taskferry.E002  the Taskferry backend 'heavy' cannot be built: CloudRunJobBackend
               needs both 'project' and 'location'
taskferry.W003  DEBUG is False but these Taskferry backends run in this process and
               lose pending work on restart: fast

The CLI, with settings loaded.

python manage.py taskferry doctor
python manage.py taskferry capabilities pg

Jobs and inline execution, through the same runtime:

from taskferry_django import get_runtime

get_runtime().jobs.submit("build-cog", image="gdal:latest", profile="heavy")

The dependency direction

taskferry never imports Django. The test suite for the core runs — and CI runs it — in an environment where Django is not installed. The same TASKFERRY dict works verbatim in a FastAPI service, a CLI or a library.

License

Apache-2.0.

Metadata

Release files for taskferry-django 0.3.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 taskferry-django 0.3.0
File Size Uploaded Provenance Actions
taskferry_django-0.3.0.tar.gz 20.6 kB With provenance Details for taskferry_django-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for taskferry-django 0.3.0
File Interpreter ABI Platform Actions
taskferry_django-0.3.0-py3-none-any.whl Python 3 none any Details for taskferry_django-0.3.0-py3-none-any.whl

Total release size: 45.9 kB

Release files / taskferry_django-0.3.0.tar.gz

Download URL taskferry_django-0.3.0.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
44908c6b6326d0e3bc0b66519adacc9a5553a1cb53ae8c1a1c21b5808af62089
BLAKE2b-256 checksum
How to use checksums
fe8c8212eec4c771a81abb287a0a18a2ef8e2dfb77b905bd57675f7ecf8fc78f
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 Nov 27, 2026.

Transparency log

Release files / taskferry_django-0.3.0-py3-none-any.whl

Download URL taskferry_django-0.3.0-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30c6d2295bcd73c2f21bf7fb9ed55cbf53b87370f3453ce822a81dd703b4fc36
BLAKE2b-256 checksum
How to use checksums
ae40f11744611e8c0eceebf96c7c81455ebf5f52480e831e6d22424ed056dfb5
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 Nov 27, 2026.

Transparency log

Security for taskferry-django 0.3.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for taskferry_django-0.3.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 Nov 27, 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.

Release history Release notifications | RSS feed

This release

0.3.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