Overview

Pydantic 2.6, released on March 21, 2024, adds experimental features and strengthens strict model configuration.

Main Features

Experimental features

The pydantic.experimental module lets you test new APIs before stabilization, such as pipeline validators.

python
from pydantic import BaseModel

class Config(BaseModel):
    model_config = {'strict': True}
    name: str
    value: int

c = Config(name='test', value=42)
print(c.value)  # 42

Strict configuration

Model-level strict mode rejects all implicit coercions on every field.

python
from pydantic import BaseModel, ConfigDict

class StrictUser(BaseModel):
    model_config = ConfigDict(strict=True)
    age: int

# StrictUser(age='30')  # ValidationError
StrictUser(age=30)       # OK

Sources