Upgrade to Pydantic 2.11

Proprietary

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.

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

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Upgrade to Pydantic 2.10
  2. Replace instance access of model_fields / model_computed_fields
  3. Replace Final model fields with a default with ClassVar
  4. Replace populate_by_name with validate_by_name