drf-oxide
Drop-in, Rust-accelerated serializers, JSON renderer and JSON parser for Django REST framework.
The Rust part lives in drf-oxide-core, the same way pydantic
sits on pydantic-core.
pip install drf-oxide
Supports Python 3.10–3.14, Django 4.2–5.2 and Django REST framework 3.14–3.16.
Usage
from drf_oxide import serializers # instead of: from rest_framework import serializers
class BookSerializer(serializers.ModelSerializer):
class Meta:
model = Book
fields = '__all__'
REST_FRAMEWORK = {
'DEFAULT_RENDERER_CLASSES': ['drf_oxide.renderers.JSONRenderer'],
'DEFAULT_PARSER_CLASSES': ['drf_oxide.parsers.JSONParser'],
}
Or, without touching imports, put drf_oxide first in INSTALLED_APPS: it swaps DRF's
Serializer, ModelSerializer, HyperlinkedModelSerializer, ListSerializer, JSONRenderer and
JSONParser for the fast ones before any other app imports its serializers.
INSTALLED_APPS = ['drf_oxide', *INSTALLED_APPS]
drf_oxide.patch() does the same from code; it has to run before the serializers are defined.
How it works
Each serializer instance is compiled once: every field gets a native kind when its class uses the stock DRF implementation, otherwise the core calls the field's own Python methods. Native code only handles the plain, valid case; anything unusual (an error, an odd input type, a value that needs rounding) is handed back to DRF, so output and error messages stay identical.
Django relations that are already loaded (select_related, prefetch_related) are read straight from
the instance caches, skipping the relation descriptors and the related managers; anything not cached goes
through the descriptor as usual.
ModelSerializer works out its model fields (model introspection, field classes and kwargs) once per
serializer class, language and settings, instead of on every instance as DRF does, as long as the class
keeps DRF's stock field-building methods. Every instance still gets its own field objects.
drf_oxide.disabled()runs plain DRF inside the block.drf_oxide = Falseon a serializer class opts it out.
Speed
make bench (1000 rows, 15 fields incl. a nested serializer, Python 3.13, release build):
| DRF | drf-oxide | ||
|---|---|---|---|
Serializer(many=True).data |
42.6 ms | 8.8 ms | 4.9x |
is_valid() on a list payload |
131.8 ms | 12.2 ms | 10.8x |
JSONRenderer.render |
5.2 ms | 2.2 ms | 2.4x |
Per field kind, serialization is ~10x for strings, ints, bools, decimals and choices; datetimes in a non-UTC active timezone and UUIDs gain less (~4x / ~2.5x).
Development
The two packages live in sibling checkouts of
Kanzey/drf-oxide and
Kanzey/drf-oxide-core; uv sync installs the core from
../drf-oxide-core.
cd ../drf-oxide-core && make develop # or `make release` for benchmarks
cd ../drf-oxide && uv sync && make test
make bench
Metadata
Release files for drf-oxide 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| drf_oxide-0.1.0.tar.gz | 14.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| drf_oxide-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / drf_oxide-0.1.0.tar.gz
| Download URL | drf_oxide-0.1.0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c622ce43020220ea282909ef2ea48c91230604bee838f0d9c8d0aae11d155ed8
|
|
BLAKE2b-256 checksum How to use checksums |
fea9969107ac3a939de8c41afbe180dfb3da04fdbc2707da715ceb6764327625
|
| 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 5, 2026.
Transparency logRelease files / drf_oxide-0.1.0-py3-none-any.whl
| Download URL | drf_oxide-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
805976bd5d0501c735ccbd9b2f03cb679e2e7fc2435eaca751aff1fb9aea41dc
|
|
BLAKE2b-256 checksum How to use checksums |
921d77838ddafd651512e05fd41ad4973b1e9aa6dea3e73c315f337af8deadb9
|
| 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 5, 2026.
Transparency log