pydantic-partial
Create partial models from your pydantic models. Partial models may allow None for certain or all fields.
Decision gist · record as of 2026-08-14
Yes, if you are building APIs with pydantic and FastAPI. The library solves a real gap in pydantic's design for PATCH requests and partial responses. Install friction is negligible, maintenance is active, and the MIT license carries no restrictions. The main caveat is that type checkers will not understand the partial optionality, so use it only for DTO/serialization contexts, not for type-critical business logic.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later and pydantic 2.x; type checkers will not recognize partial field optionality.
- Low install friction with a single pydantic dependency.
- Actively maintained with recent releases; last commit 2026-08-08 and latest release 2026-06-26 indicate ongoing support.
License · maintenance · safety
MIT (permissive) — MIT license permits use in commercial and private projects with minimal restrictions, requiring only license and copyright notice retention.
last release 2026-06-26 (49 days) · last repo commit 2026-08-08 · 78 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 194,591 downloads/mo, #9,830 on PyPI
Alternatives
Verify before relying
pip install pydantic-partial
import pydantic
from pydantic_partial import PartialModelMixin
class User(PartialModelMixin, pydantic.BaseModel):
name: str
age: int
UserPartial = User.model_as_partial()
user = UserPartial() # Both fields now optional- Whether partial models work correctly with pydantic validators and computed fields beyond the documented examples.
- Performance impact when creating many partial model variants from large model hierarchies.
- Compatibility with pydantic serialization modes (mode='json', mode='python') in partial contexts.
What it is and what it does
pydantic-partial is a mixin and utility library that generates optional variants of pydantic models. It lets you take a normal pydantic BaseModel and create a version where all fields, or just selected ones, become optional and accept None values. This is particularly useful for API endpoints handling PATCH requests, where clients only send fields they want to update, or for response DTOs where you want to omit certain fields without validation errors.
The library provides two main interfaces: a PartialModelMixin you can inherit from, and a standalone create_partial_model() function for models you don't control. It also supports recursive partials for nested model structures. The tradeoff is that type checkers cannot see the optionality changes—partial models appear to type checkers as identical to their originals—so the library is best suited for API data-transfer scenarios rather than complex type-aware logic.
Use it for
- Handle PATCH HTTP requests where only some fields are provided and should not trigger validation errors for missing required fields.
- Create response DTOs that omit certain fields without raising validation errors when combined with exclude_none.
- Build flexible API request/response models that adapt field optionality based on use case without duplicating model definitions.
- Support partial updates in database operations where only changed fields need to be validated and persisted.
- Generate test fixtures and mock objects where you need to construct models with minimal required data.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building APIs with pydantic and FastAPI.
The library solves a real gap in pydantic's design for PATCH requests and partial responses. Install friction is negligible, maintenance is active, and the MIT license carries no restrictions. The main caveat is that type checkers will not understand the partial optionality, so use it only for DTO/serialization contexts, not for type-critical business logic.
Install
pydantic-partial on PyPI
Before you install
Low install friction with a single pydantic dependency. Actively maintained with recent releases; last commit 2026-08-08 and latest release 2026-06-26 indicate ongoing support.
Requires Python 3.10 or later and pydantic 2.x; type checkers will not recognize partial field optionality.
License in practice
MIT license permits use in commercial and private projects with minimal restrictions, requiring only license and copyright notice retention.
Quickstart
pip install pydantic-partial
import pydantic
from pydantic_partial import PartialModelMixin
class User(PartialModelMixin, pydantic.BaseModel):
name: str
age: int
UserPartial = User.model_as_partial()
user = UserPartial() # Both fields now optional
Verify before relying
- Whether partial models work correctly with pydantic validators and computed fields beyond the documented examples.
- Performance impact when creating many partial model variants from large model hierarchies.
- Compatibility with pydantic serialization modes (mode='json', mode='python') in partial contexts.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepydantic |
| Maintenance | Actively maintained 49 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 194,591 / month, #9,830 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: pydantic_partial-0.11.1-py3-none-any.whl
Tags
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 optional fields”
- pydantic-partialConverts pydantic models into partial variants where all or selected…
- pydantic-xmlPydantic-xml adds XML serialization and deserialization to pydantic…
- sparkdanticConverts Pydantic models to PySpark schemas (StructType or JSON…
Give your agent the search over MCP, or paste the wish link into any chat.
More Application Frameworks packages
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Textual is a Python framework for building cross-platform user interfaces that run in the terminal or web browser using a modern, component-based API.
Install it if you're developing CLI tools, dashboards, or interactive terminal applications.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Build and connect to Model Context Protocol servers that expose tools, resources, and prompts to LLM applications over stdio, HTTP, or SSE transports.
Install it if you need to build or connect to servers.
Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.
See also django-pydantic-field · Flask-Pydantic · flask-pydantic-spec · jsonschema-pydantic-converter · jsonschema-pydantic · sparkdantic · drf-pydantic · pydantic_core · dydantic · pydantic-numpy