Allow computed fields (and methods) to be provided with `create_model()`
Author: ViicosCreated Apr 7, 2025Updated Sep 29, 2026
Labelsfeature requestv3
Initial Checks
- I have searched Google & GitHub for similar requests and couldn't find anything
- I have read and followed the docs and still think this feature is missing
Description
As per https://github.com/pydantic/pydantic/issues/11708 and https://github.com/pydantic/pydantic/discussions/7760.
Affected Components
- Compatibility between releases
- Data validation/parsing
- Data serialization -
.model_dump()and.model_dump_json() - JSON Schema
- Dataclasses
- Model Config
- Field Types - adding or changing a particular data type
- Function validation decorator
- Generic Models
- Other Model behaviour -
model_construct(), pickling, private attributes, ORM mode - Plugins and integration with other tools - mypy, FastAPI, python-devtools, Hypothesis, VS Code, PyCharm, etc.
Source: pydantic/pydantic