{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/17"}],"enrichment":{"capability":"Bridges pydantic models and Django REST framework by automatically generating DRF serializers from pydantic model definitions, enabling pydantic validation within DRF views.","skillfed_tags":["django-rest-framework","pydantic-v2","serialization"],"use_cases":["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."],"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.\n\nThe 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.","worth_installing":"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."},"id":"drf-pydantic","links":{"html":"https://skillfed.io/packages/drf-pydantic","md":"https://skillfed.io/packages/drf-pydantic.md","pypi":"https://pypi.org/project/drf-pydantic/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2025-12-14","license_spdx":"MIT","license_treatment":"permissive","name":"drf-pydantic","python_support":"supports_current","summary":"Use pydantic with the Django REST framework"},"popularity":{"monthly_downloads":173258,"position":10313,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"2.9.1"}
