Metadata-Version: 2.4
Name: drf-oxide-core
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Typing :: Typed
License-File: LICENSE
Summary: Rust core for drf-oxide: compiled Django REST framework serializers
Keywords: django,django-rest-framework,drf,serializers,rust,performance
Author-email: Kamil Kobza <kamil1pl@gmail.com>
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/Kanzey/drf-oxide-core
Project-URL: Issues, https://github.com/Kanzey/drf-oxide-core/issues
Project-URL: Repository, https://github.com/Kanzey/drf-oxide-core

# drf-oxide-core

Rust core (PyO3 + maturin) of [`drf-oxide`](https://pypi.org/project/drf-oxide/), a drop-in,
Rust-accelerated Django REST framework. Install `drf-oxide`; this package is its dependency and is
not meant to be used on its own.

It knows nothing about Django; `drf_oxide` passes the DRF / Django objects it needs once through
`configure()` and then builds a
`CompiledSerializer` per serializer instance from a plain-dict schema.

- `CompiledSerializer(read_fields, write_fields)`
  - `.to_representation(instance, current_tz)` / `.to_representation_many(iterable, current_tz)`
  - `.to_internal_value(data, current_tz)` -> `(validated, errors | None)`
  - `.describe()` - which strategy each field got (native kind or `python`)
- `to_json(obj, *, ensure_ascii, compact, allow_nan, default)` - byte-for-byte `json.dumps` with
  DRF's encoder; raises `JsonFallback` when it cannot guarantee that.
- `from_json(data, *, allow_nan)` - parsing via `jiter`.

Native code only handles the plain, valid case and returns "not handled" otherwise; the caller then
runs the DRF implementation, which produces the exact result or error.

## Development

```sh
uv venv && uv sync
make develop      # debug build into .venv; `make release` for benchmarks
make test         # cargo test + pytest
make lint
```

Requires Rust >= 1.83 (`jiter` 0.13 / `pyo3` 0.28).

