django-tasks-repid
A django-tasks backend powered by repid.
Requirements
- Python 3.12+
- Django 6.0+
- django-tasks 0.12+
- repid 1.6+
Installation
pip install django-tasks-repid
Configuration
Add the backend to your TASKS setting:
TASKS = {
"default": {
"BACKEND": "django_tasks_repid.backend.RepidBackend",
"QUEUES": ["default"],
"OPTIONS": {
"BROKER": "redis://localhost:6379",
"RESULT_BACKEND": "redis://localhost:6379",
},
}
}
Options
| Option | Description | Default |
|---|---|---|
BROKER |
Message broker DSN. Supports amqp://, redis://, valkey://. |
In-memory (development only) |
RESULT_BACKEND |
Redis DSN for storing task results. Required for get_result(). |
None (results unavailable) |
Supported brokers
| Scheme | Backend |
|---|---|
amqp:// |
RabbitMQ |
redis:// |
Redis |
valkey:// |
Valkey (protocol-compatible with Redis) |
| (none) | In-memory (single-process, non-persistent — development only) |
Defining tasks
from django_tasks import task
@task()
def send_welcome_email(user_id: int) -> None:
...
@task()
async def generate_report(report_id: int) -> dict:
...
Enqueueing tasks
# Sync
result = send_welcome_email.enqueue(user_id=42)
# Async
result = await send_welcome_email.aenqueue(user_id=42)
# Deferred
from datetime import datetime, timedelta, timezone
result = send_welcome_email.using(
run_after=datetime.now(tz=timezone.utc) + timedelta(hours=1)
).enqueue(user_id=42)
Retrieving results
get_result() and aget_result() require RESULT_BACKEND to be configured.
from django_tasks import default_task_backend
result = send_welcome_email.enqueue(user_id=42)
# Later — fetch updated status
result = default_task_backend.get_result(result.id)
if result.is_finished:
print(result.return_value)
Running a worker
Use repid's worker to consume and execute tasks:
# worker.py
import django
django.setup()
import asyncio
from repid import Connection, Queue, Repid, Router
from repid.connections import RedisMessageBroker
from myapp.tasks import send_welcome_email
router = Router()
router.include_func(send_welcome_email.func)
async def main():
async with Repid(Connection(RedisMessageBroker("redis://localhost:6379"))).magic():
await Queue("default").declare()
worker = router.create_worker(Queue("default"))
await worker.run()
asyncio.run(main())
Development / testing
The in-memory broker (no BROKER configured) is useful for tests:
# settings.py
TASKS = {
"default": {
"BACKEND": "django_tasks_repid.backend.RepidBackend",
"OPTIONS": {},
}
}
Run the test suite:
uv run pytest
License
MIT
Metadata
Release files for django-tasks-repid 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_tasks_repid-0.1.2.tar.gz | 4.0 kB | Without provenance | Details for django_tasks_repid-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_tasks_repid-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for django_tasks_repid-0.1.2-py3-none-any.whl |
Total release size: 9.1 kB
Release files / django_tasks_repid-0.1.2.tar.gz
| Download URL | django_tasks_repid-0.1.2.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
705f36771520c4720e89ce0367b3d7a9c1b88f4388bb6e92bcda9fa3540198f7
|
|
BLAKE2b-256 checksum How to use checksums |
eb60d2d60be168e80bbcfb14020892f393cc9eff3328c6866e99eefaeb7959fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / django_tasks_repid-0.1.2-py3-none-any.whl
| Download URL | django_tasks_repid-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7f465b8e42aaecc680b2f2d59edfeb12e4732b01e9358109d00520f7d5a7d9f
|
|
BLAKE2b-256 checksum How to use checksums |
7f64f6112079b17026204731fe7ad859492cc95cf29ef0fe9478a4708c6bb959
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for django-tasks-repid 0.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.