bump-pydantic
Convert Pydantic from V1 to V2 ♻
What it is and what it does
Bump Pydantic is a command-line tool that automates the migration of Pydantic V1 code to V2 by applying nine transformation rules (BP001–BP009). It handles common refactoring tasks such as replacing the Config class with model_config, updating Field parameters, converting validators to their V2 equivalents, and replacing deprecated constraint functions with Annotated types. The tool uses libcst for safe AST-based code transformation and provides a --diff flag to preview changes before applying them.
The tool is designed for developers maintaining Pydantic V1 projects who need to upgrade to V2 but face large codebases where manual refactoring is impractical. It covers the majority of straightforward migration patterns, though complex custom types and protocol functions may require manual follow-up (flagged with TODO comments). The project is archived and no longer actively maintained, so it will not evolve with future Pydantic V2 releases.
Use it for:
- Bulk-migrate a Pydantic V1 codebase to V2 by running the tool on your package directory and reviewing the generated diff.
- Automate replacement of Config classes with model_config and Field parameter updates across multiple files.
- Convert V1 validators (@validator, @root_validator) to their V2 equivalents (@field_validator, @model_validator) in one pass.
- Replace constraint functions (constr, conint, etc.) with Annotated type hints across a large project.
- Identify and mark custom type methods (__get_validators__, __modify_schema__) that require manual V2 migration with TODO comments.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A CLI tool that automatically refactors Pydantic V1 code to V2 by applying targeted transformation rules to imports, field definitions, validators, and configuration patterns.
Yes, if you have a Pydantic V1 codebase to migrate and need to automate routine refactoring tasks. The tool handles the majority of straightforward patterns and is low-friction to install. However, be aware that the project is archived and no longer maintained—it will not adapt to new Pydantic V2 features or Python versions, and complex migrations may still require manual work. Use it as a starting point rather than a complete solution.
Install
bump-pydantic on PyPI
pip
pip install bump-pydanticuv
uv add bump-pydanticpoetry
poetry add bump-pydanticInstalling bump-pydantic
Before you install
Low install friction with a pure-Python wheel and four lightweight dependencies. However, the project is archived and has not been updated since late 2023, meaning it will not receive fixes for new Pydantic V2 patterns or Python versions beyond 3.12.
License in practice
MIT license (permissive) allows free use, modification, and distribution with minimal restrictions, suitable for both open-source and commercial projects.
Quickstart
pip install bump-pydantic
bump-pydantic /path/to/my_package
# Or check diff first:
bump-pydantic --diff /path/to/my_package
Requires Python 3.8 or later; the tool operates on source files in place or via diff, so a version control system is recommended to review and revert changes if needed.
Verify before relying
- Whether the tool correctly handles all edge cases in real-world Pydantic V1 codebases, given the project is no longer maintained.
- Performance and accuracy on large projects with complex validator chains or custom type definitions.
- Compatibility with Pydantic V2 minor versions released after the tool's last update in December 2023.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — libcst, rich, typer, typing-extensions |
| Maintenance | abandoned — 960 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 229,283/month — #9,134 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: bump_pydantic-0.8.0-py3-none-any.whl
Tags
More Code Generators packages
Proto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
CythonCython is a source code translator that…
permissive · top 1,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
beartypeBeartype is a runtime type checker that…
permissive · top 1,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
astorastor converts Python abstract syntax trees…
permissive · top 5,000 on PyPI
pydantic-compatProvides compatibility mixins and adapters to…
permissive · top 15,000 on PyPI
prime-pydantic-configBuilds a command-line interface from Pydantic…
unclear · top 15,000 on PyPI
flask-pydantic-specAdds OpenAPI documentation generation and…
unclear · top 15,000 on PyPI
Flask-PydanticAdds Pydantic model validation to Flask route…
permissive · top 15,000 on PyPI
pylint-pydanticA Pylint plugin that extends Pylint's…
copyleft · top 5,000 on PyPI
jsonschema-pydantic-converterConverts JSON Schema definitions to Pydantic v2…
permissive · top 15,000 on PyPI
pydantic-to-typescript2Converts Pydantic models to TypeScript…
permissive · top 15,000 on PyPI
pydantic_yamlPydantic-YAML adds YAML serialization and…
permissive · top 5,000 on PyPI
pydantic-to-typescriptConverts pydantic model definitions into…
permissive · top 5,000 on PyPI
clabeValidates and generates CLABE numbers, Mexico's…
permissive · top 15,000 on PyPI