Skip to main content

django-aiodrf

django-aiodrf

Awaitable views, serializers and policy hooks for Django REST framework.

aiodrf extends DRF's classes and preserves its request, validation and response contracts. Migrate endpoints incrementally: async implementations are awaited; synchronous hooks that may perform I/O execute in a thread-sensitive worker. Existing DRF serializers, routers, authentication and permission classes remain usable.

The package is alpha and its API may change; CHANGELOG.md lists the releases. The distribution name is django-aiodrf; imports use aiodrf.

Installation

For this development checkout:

uv venv --python 3.12
uv pip install -e .

Install with uv:

uv add django-aiodrf

Install with pip:

pip install django-aiodrf

Optional dependencies are selected explicitly, for example django-aiodrf[filter,spectacular].

Add the application to Django settings:

INSTALLED_APPS = [
    # Your existing Django applications.
    "rest_framework",
    "aiodrf",
]

Keep authentication, permission, parser and renderer configuration in REST_FRAMEWORK. Optional aiodrf behavior is configured through AIODRF; the default configuration requires no optimization settings.

Basic usage

# project/urls.py
from django.urls import path

from aiodrf.response import Response
from aiodrf.views import APIView


class StatusView(APIView):
    async def get(self, request):
        return Response({"status": "ok"})


urlpatterns = [
    path("status/", StatusView.as_view()),
]

Serve the project with an ASGI server. aiodrf's aiodrf.asgi.get_asgi_application() is needed only for its optional features, such as the lifespan context manager.

For model APIs, aiodrf provides ModelViewSet, generic views and serializers with async methods. Plain DRF serializers can also be used through aiodrf.aio.is_valid(), save() and data(). Supported extension hooks have explicit sync/async pairs such as get_queryset() / aget_queryset().

Capabilities and boundaries

  • DRF-style views, routers, validation, authentication, permissions and throttling.
  • Awaitable serializer operations and compatible synchronous extension hooks.
  • Typed lifespan resources, streaming responses and conditional requests.
  • Optional msgspec/Pydantic serializers, compiled serializer backends (msgspec, Pydantic, or plain Python without a dependency) and selective field-copy optimizations.
  • Tested integrations for filtering, OpenAPI, object permissions, caching, background tasks and SQL/NoSQL access.

Django's async ORM methods still run the database driver synchronously, in a worker thread; await alone does not make database access natively asynchronous. aiodrf keeps synchronous code it cannot verify off the event loop. Compiled serializers, the native database backend and the compatibility layers are opt-in, and their guides describe their limits. How much faster an async API is depends on the application and its deployment.

Compatibility

Python 3.12, 3.13 and 3.14, including a separate free-threaded test session:

Django DRF
5.2 3.16, 3.17, 3.18
6.0 3.17, 3.18
6.1 3.18

Tests run on SQLite and PostgreSQL, against DRF's own test suite and with a selection of third-party packages; the ecosystem guide lists them.

Documentation

The aiodrf documentation covers migration, configuration, the API reference and the examples, which run locally with uv or with Docker Compose.

Use the Django documentation for models, middleware, settings and deployment, and the Django REST framework documentation for DRF's API. aiodrf's guides describe what aiodrf adds and do not repeat those references.

Development

uv pip install -e . --group dev
uv run --no-sync pytest
uv run --no-sync nox -s lint typecheck docs

The contribution guide describes the development workflow, the test sessions and the code standards.

Credits

django-aiodrf builds on Django REST framework. Thank you to the DRF team and contributors for its API design, implementation, documentation and compatibility tests, and to the Django and asgiref contributors for the request handling and async infrastructure it relies on. Adapted source code keeps its license notices and attribution.

django-aiodrf is an independent project. It is not part of Django or DRF, nor endorsed by them.

Metadata

Release files for django-aiodrf 0.0.2

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-aiodrf 0.0.2
File Size Uploaded
django_aiodrf-0.0.2.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-aiodrf 0.0.2
File Interpreter ABI Platform
django_aiodrf-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / django_aiodrf-0.0.2.tar.gz

Download URL django_aiodrf-0.0.2.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
703316860162702e98c6d62671e0b7c8dc73b5110286d3264c0cbfcda317e597
BLAKE2b-256 checksum
How to use checksums
796db051f90f6e9a6923a4cd02b4070dd1700a0647bfa1951284b2318970bcd2
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 Oct 1, 2026.

Transparency log

Release files / django_aiodrf-0.0.2-py3-none-any.whl

Download URL django_aiodrf-0.0.2-py3-none-any.whl
Size 289.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8629665214f003924c3f0e6bb1eafb5e4bf78f87078f962f5ef92bf8514e2bbc
BLAKE2b-256 checksum
How to use checksums
290c0337052d4e48411642c8a56bb2d554f20beff79098c5ff2b9fbcfd75fede
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 Oct 1, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

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