$npx skillfedfor your agent

drf-pydantic

Use pydantic with the Django REST framework

Worth itPyPI Python ModulesReleased Dec 2025173.3K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — drf_pydantic-2.9.1-py3-none-any.whl
v2.9.1 · released 2025-12-14 · Python >=3.9 · 2 runtime deps: djangorestframework, pydantic

Yes. The package is production-stable (Development Status 5), has no known vulnerabilities, and solves a real friction point for teams using both pydantic and Django REST framework. Low install friction and active maintenance make it a straightforward addition. Install it if you are building DRF APIs and want to unify your validation layer around pydantic models.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low friction install with only two runtime dependencies (djangorestframework and pydantic).
  • Repository shows active maintenance with recent commits and no archived status, though the aging signal suggests releases are spaced further apart.

License · maintenance · safety

MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.

last release 2025-12-14 (243 days) · last repo commit 2025-12-14 · 147 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 173,258 downloads/mo, #10,313 on PyPI

Verify before relying

pip install drf-pydantic

from drf_pydantic import BaseModel

class MyModel(BaseModel):
    name: str
    addresses: list[str]

my_serializer = MyModel.drf_serializer(data={"name": "Van", "addresses": ["Gym"]})
my_serializer.is_valid(raise_exception=True)
  • Whether the translation from pydantic to DRF serializers handles all pydantic field types and validators without gaps.
  • Performance characteristics when validate_pydantic is enabled on large or deeply nested models.
  • Compatibility guarantees with specific versions of djangorestframework beyond the runtime dependency declaration.
Same gist for agents: .md · .json

What it is and what it does

drf-pydantic lets you use pydantic models as the source of truth for data validation in Django REST framework APIs. Instead of writing separate DRF serializers, you define a pydantic model using drf-pydantic's BaseModel, and the package automatically generates an equivalent DRF serializer accessible via the model's drf_serializer attribute. The translation happens at class creation time, so there is no runtime overhead during request handling.

The package supports pydantic v2 and integrates pydantic's validation rules into DRF's serializer validation pipeline. You can enable full pydantic validation by setting validate_pydantic to True in the model's drf_config, which runs pydantic's validators whenever the DRF serializer validates data. It also handles nested models, field customization, and error wrapping so that pydantic ValidationErrors appear as DRF ValidationErrors in your API responses.

Use it for

  • Build REST APIs where pydantic models define both your data schema and validation logic, eliminating duplicate serializer definitions.
  • Migrate existing pydantic-based services to Django REST framework without rewriting validation rules.
  • Leverage pydantic's validation within DRF views for complex field or model-level validation.
  • Extend existing pydantic models with DRF serialization by adding drf_pydantic.BaseModel as a parent class.
  • Access the fully validated pydantic instance via the pydantic_instance property after validation succeeds.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

The package is production-stable (Development Status 5), has no known vulnerabilities, and solves a real friction point for teams using both pydantic and Django REST framework. Low install friction and active maintenance make it a straightforward addition. Install it if you are building DRF APIs and want to unify your validation layer around pydantic models.

Install

drf-pydantic on PyPI

Before you install

Low friction install with only two runtime dependencies (djangorestframework and pydantic). Repository shows active maintenance with recent commits and no archived status, though the aging signal suggests releases are spaced further apart.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for commercial and open-source projects alike.

Quickstart

pip install drf-pydantic

from drf_pydantic import BaseModel

class MyModel(BaseModel):
    name: str
    addresses: list[str]

my_serializer = MyModel.drf_serializer(data={"name": "Van", "addresses": ["Gym"]})
my_serializer.is_valid(raise_exception=True)

Verify before relying

  • Whether the translation from pydantic to DRF serializers handles all pydantic field types and validators without gaps.
  • Performance characteristics when validate_pydantic is enabled on large or deeply nested models.
  • Compatibility guarantees with specific versions of djangorestframework beyond the runtime dependency declaration.

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
djangorestframeworkpydantic
MaintenanceAging 243 days since the last release
Last repo commit
First released
Downloads173,258 / month, #10,313 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Evidence: drf_pydantic-2.9.1-py3-none-any.whl

Tags

Capabilities
pydantic django rest framework integrationdrf serializer from pydantic modeldjango rest framework validationpydantic drf bridgeautomatic serializer generationpydantic v2 drf supportrest api validation pydantic
Topics
django-rest-frameworkpydantic-v2serialization
PyPI keywords
apidjangodrfpydanticresttyping

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pydantic django rest framework integration”

  • drf-pydanticBridges pydantic models and Django REST framework by automatically…
  • django-pydantic-fieldProvides type-safe Pydantic model schemas for Django JSONFields with…
  • django-ninjaDjango Ninja builds type-hint-based REST APIs on top of Django, using…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also djangorestframework-dataclasses · django-pydantic-field · pydantic_yaml · drf-recaptcha · pydantic-collections · drf-jsonschema-serializer · pydantic-extra-types · Flask-Pydantic · pydantic-function-models · drf-dynamic-fields