Skip to main content

django_tasks_pubsub

Google Cloud Pub/Sub backend for Django tasks

Installation

Package manager

pip

pip install django_tasks_pubsub

uv

uv add django_tasks_pubsub

Add to INSTALLED_APPS

INSTALLED_APPS = [
    ...
    "django_tasks_pubsub",
]

Settings

Idempotency check

add to settings what prefix you want for me to check idempotency

this will ensure that the task is not executed multiple times for the same message

uses django cache framework to check status of ongoing tasks

DJANGO_TASKS_PUBSUB_CACHE_PREFIX = 'some_prefix'

Add required Google Cloud Pub/Sub settings

PUBSUB_PROJECT_ID = "your-google-cloud-project-id"
PUBSUB_DEFAULT_TOPIC_ID = "your-default-topic-id"

Add the backend to the TASKS setting

TASKS = {
    "default": {
        "BACKEND": "django_tasks_pubsub.PubSubBackend",
    }
}

Authentication

Check out the Google Cloud Pub/Sub documentation for more information.

In short the the client works well within a Google Cloud environment.

URLs

In order to receive push messages from Google Cloud Pub/Sub, you need to register the endpoint in your project's urls.py:

from django.urls import path, include

urlpatterns = [
    ...
    path("", include("django_tasks_pubsub.urls")),
]

This will expose the endpoint at /pubsub/push/. You should configure your Google Cloud Pub/Sub push subscription to use this endpoint (e.g. https://your-domain.com/pubsub/push/).

Usage

Configure Django task functions

from django.tasks import task

@task
def send_email(user_id):
    print(f"Sending email to {user_id}")

Configure specifics for the task

Specify a topic

To specify a topic, you need to decorate the task with @task and @pubsub_task(topic="topic-name") in this order:

from django.tasks import task
from django_tasks_pubsub import pubsub_task


@task
@pubsub_task(topic_id="images")
def function(image_id: int):
    ...

Development

Commit Messages

All commits to this repository must follow the Conventional Commits specification.

This is required because the automated release and tagging workflow relies on conventional commit prefixes (such as feat:, fix:, chore:, docs:, etc.) to automatically calculate the next semantic version.

License

MIT

Release files for django-tasks-pubsub 0.2.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 django-tasks-pubsub 0.2.0
File Size Uploaded
django_tasks_pubsub-0.2.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-tasks-pubsub 0.2.0
File Interpreter ABI Platform
django_tasks_pubsub-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / django_tasks_pubsub-0.2.0.tar.gz

Download URL django_tasks_pubsub-0.2.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
693afbf94cc4f4c02f40b2a9583d2193117b802d21f20d9bd5e40faeebf0d2ec
BLAKE2b-256 checksum
How to use checksums
d1d2471ae231ea1f5d5335dacbb1b8065fa6ffd29e2ba3921c164ea580cb774a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 4, 2026.

Transparency log

Release files / django_tasks_pubsub-0.2.0-py3-none-any.whl

Download URL django_tasks_pubsub-0.2.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f17b5cb973e27e8c74741b4315d893363d78559b5596b337618a0a787f4cc4d6
BLAKE2b-256 checksum
How to use checksums
dab4fe0c562b7975c4626044409c740e8300d2c0e693f2c0ff60fc0b965fbe13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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