← All recipes
Moderne licensed

Upgrade to Pydantic 2.11

Recipe IDorg.openrewrite.python.migrate.pydantic.UpgradeToPydantic211Artifactopenrewrite-migrate-python

Migrate code affected by deprecations introduced in Pydantic 2.11 (and 2.10). Rewrites instance access of model_fields / model_computed_fields to class access, rewrites Final model fields with default values to ClassVar, and renames populate_by_name to validate_by_name.

Composite recipepythonpydanticmigration2.11Proprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.python.migrate.pydantic.UpgradeToPydantic211

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-migrate-python

Definition

This recipe runs the following recipes in order.