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— theDATABASESalias to use (default"default").DEFAULT_MAX_ATTEMPTS— retry ceiling per task (default5).QUEUES— a map of queue name →absurd_sdk.CreateQueueOptions, for per-queue customization. Use this instead of the top-levelQUEUESlist (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.
migraterunsCREATE EXTENSION IF NOT EXISTS "uuid-ossp"andCREATE SCHEMA IF NOT EXISTS absurd, so the migrating role needs rights to create extensions and schemas (a superuser, or a role granted those — withuuid-osspallow-listed on managed Postgres). The schema nameabsurdis 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_keywhere it helps. - Queue sync is additive.
absurd_sync_queuescreates/updates configured queues but never drops queues removed from config. A queue'sstorage_modeis immutable after creation (a change is reported as a warning, not applied). - Teardown is destructive.
migrate django_absurd zerodrops theabsurdschema 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
absurdschema 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
664434130f49ebdba1b78d695909af02356fb89a9f44b20853aa4914deed66b3
|
|
| MD5 |
df7625aa5727972056d31735f860f0ca
|
|
| BLAKE2b-256 |
17eceea79a3cc71822b1114225bd234480486a369f3cd1eb535141e439b39a82
|
Provenance
The following attestation bundles were made for django_absurd-0.1.0a3.tar.gz:
Publisher:
publish.yml on lincolnloop/django-absurd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_absurd-0.1.0a3.tar.gz -
Subject digest:
664434130f49ebdba1b78d695909af02356fb89a9f44b20853aa4914deed66b3 - Sigstore transparency entry: 1942353133
- Sigstore integration time:
-
Permalink:
lincolnloop/django-absurd@14d28151dcebe03c61dbd86d34a5dde9db9cb49c -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/lincolnloop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14d28151dcebe03c61dbd86d34a5dde9db9cb49c -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50f933405856feeccbc0c428518349fcedac6fd87f486513560e49c82719aa6f
|
|
| MD5 |
474e5b0c8ca8a018887138c68d9de779
|
|
| BLAKE2b-256 |
eaa80d71d1476377e8fbde4109152a956ce8450e55b549b898d7406bc9dd29a4
|
Provenance
The following attestation bundles were made for django_absurd-0.1.0a3-py3-none-any.whl:
Publisher:
publish.yml on lincolnloop/django-absurd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_absurd-0.1.0a3-py3-none-any.whl -
Subject digest:
50f933405856feeccbc0c428518349fcedac6fd87f486513560e49c82719aa6f - Sigstore transparency entry: 1942353278
- Sigstore integration time:
-
Permalink:
lincolnloop/django-absurd@14d28151dcebe03c61dbd86d34a5dde9db9cb49c -
Branch / Tag:
refs/tags/v0.1.0a3 - Owner: https://github.com/lincolnloop
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14d28151dcebe03c61dbd86d34a5dde9db9cb49c -
Trigger Event:
release
-
Statement type: