skillfed

bump-pydantic

Convert Pydantic from V1 to V2 ♻

bump-pydantic v0.8.0 229.3K downloads/30d#9,134 on PyPI351
Permissive license Abandoned released

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-pydantic

uv

uv add bump-pydantic

poetry

poetry add bump-pydantic

Installing 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

Development Status :: 4 - BetaEnvironment :: ConsoleFramework :: PydanticLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Code Generators

Tags

pydantic v1 to v2 migrationpydantic code refactoring toolautomated pydantic upgradepydantic v2 migration cliconvert pydantic models v1 v2
pydantic-migrationcode-refactoringcli-tool

More Code Generators packages