Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

django-absurd

Django integration for Absurd, the Postgres-native workflow engine. Wraps Absurd's SDK so it reuses Django's database connection, ships its schema as Django migrations, and exposes its queues and tasks through Django settings, management commands, and system checks.

Alpha. APIs and behavior may change between releases.

Requirements

  • Python 3.12+
  • Django 6.0+
  • PostgreSQL with the psycopg (v3) Django backend (the Absurd SDK reuses Django's connection and requires psycopg3)

Installation

pip install django-absurd

Pre-release tags (e.g. v0.1.0a1) upload as PyPI pre-releases, which pip install skips unless you pass --pre:

pip install --pre django-absurd

Configuration

Add the app, register the router, and point Django's TASKS setting at the backend:

INSTALLED_APPS = [
    # ...
    "django_absurd",
]

DATABASE_ROUTERS = ["django_absurd.routers.AbsurdRouter"]

TASKS = {
    "default": {
        "BACKEND": "django_absurd.backends.AbsurdBackend",
        "QUEUES": ["default"],  # queue names this app enqueues to
    },
}

Backend OPTIONS (all optional):

  • DATABASE — the DATABASES alias to use (default "default").
  • DEFAULT_MAX_ATTEMPTS — retry ceiling per task (default 5).
  • QUEUES — a map of queue name → absurd_sdk.CreateQueueOptions, for per-queue customization. Use this instead of the top-level QUEUES list (which only names queues) — declare queues in one place or the other, never both (setting both is a configuration error).

Setup

python manage.py migrate              # create Absurd's schema (offline, shipped SQL)
python manage.py absurd_sync_queues   # create/update the configured queues
python manage.py absurd_worker        # run a worker

migrate does not create any queues — run absurd_sync_queues after configuring QUEUES. Validate configuration at any time with python manage.py check django_absurd.

Defining and enqueuing tasks

Use Django's Tasks API. Attach Absurd options per task (a decorator, applied below @task) or per call:

from django.tasks import task
from django_absurd.params import AbsurdSpawnParams, absurd_default_params

@task
@absurd_default_params(max_attempts=3)
def send_report(user_id): ...

send_report.enqueue(42)
send_report.enqueue(42, absurd_spawn_params=AbsurdSpawnParams(idempotency_key="report-42"))

Parameters: max_attempts, retry_strategy, cancellation (defaults and per call), plus headers and idempotency_key (per call). Enqueuing rides the surrounding Django transaction — a task spawned inside atomic() is rolled back if the block fails (enqueue-on-commit, automatic).

Deployment notes

  • Database privileges. migrate runs CREATE EXTENSION IF NOT EXISTS "uuid-ossp" and CREATE SCHEMA IF NOT EXISTS absurd, so the migrating role needs rights to create extensions and schemas (a superuser, or a role granted those — with uuid-ossp allow-listed on managed Postgres). The schema name absurd is fixed.
  • At-least-once delivery. A task may run more than once (e.g. a crash between the handler committing and Absurd's bookkeeping). Keep handlers idempotent; use idempotency_key where it helps.
  • Queue sync is additive. absurd_sync_queues creates/updates configured queues but never drops queues removed from config. A queue's storage_mode is immutable after creation (a change is reported as a warning, not applied).
  • Teardown is destructive. migrate django_absurd zero drops the absurd schema and all data in it.

Adopting an existing Absurd database

If the target database already runs Absurd (its schema managed outside Django), you can fake django-absurd's migration so Django records it as applied without re-running the DDL:

python manage.py migrate --fake django_absurd

Use extreme caution. Faking tells Django the schema is already present without checking it. Only do this when the existing absurd schema exactly matches the version django-absurd targets (django_absurd.ABSURD_SCHEMA_VERSION) — a mismatch causes runtime failures Django cannot detect. Verify the versions line up before faking.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_absurd-0.1.0a3.tar.gz (33.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_absurd-0.1.0a3-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file django_absurd-0.1.0a3.tar.gz.

File metadata

  • Download URL: django_absurd-0.1.0a3.tar.gz
  • Upload date:
  • Size: 33.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for django_absurd-0.1.0a3.tar.gz
Algorithm Hash digest
SHA256 664434130f49ebdba1b78d695909af02356fb89a9f44b20853aa4914deed66b3
MD5 df7625aa5727972056d31735f860f0ca
BLAKE2b-256 17eceea79a3cc71822b1114225bd234480486a369f3cd1eb535141e439b39a82

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_absurd-0.1.0a3.tar.gz:

Publisher: publish.yml on lincolnloop/django-absurd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_absurd-0.1.0a3-py3-none-any.whl.

File metadata

  • Download URL: django_absurd-0.1.0a3-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for django_absurd-0.1.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 50f933405856feeccbc0c428518349fcedac6fd87f486513560e49c82719aa6f
MD5 474e5b0c8ca8a018887138c68d9de779
BLAKE2b-256 eaa80d71d1476377e8fbde4109152a956ce8450e55b549b898d7406bc9dd29a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_absurd-0.1.0a3-py3-none-any.whl:

Publisher: publish.yml on lincolnloop/django-absurd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
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