Upgrade to Pydantic 2.10
Recipe ID
org.openrewrite.python.migrate.pydantic.UpgradeToPydantic210Artifactopenrewrite-migrate-pythonFlag and migrate code affected by deprecations introduced in Pydantic 2.10, such as the deprecated schema_generator config option and the discouraged Field(...) Ellipsis form. Also flags the deprecated json_encoders config option.
Composite recipepythonpydanticmigration2.10Proprietary
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.UpgradeToPydantic210If the recipe isn’t available locally, install it with:
mod config recipes pip install openrewrite-migrate-pythonDefinition
This recipe runs the following recipes in order.
- Find deprecated
schema_generatorconfig optionorg.openrewrite.python.migrate.pydantic.FindDeprecatedSchemaGenerator - Find deprecated
json_encodersconfig optionorg.openrewrite.python.migrate.pydantic.FindDeprecatedJsonEncoders - Remove
...(Ellipsis) fromField()org.openrewrite.python.migrate.pydantic.RemoveEllipsisFromField