https://github.com/peter554/codemodpydanticv1
Upgrade Pydantic to V2, but use V1 API
https://github.com/peter554/codemodpydanticv1
codemod libcst pydantic pydantic-v2
Last synced: about 1 year ago
JSON representation
Upgrade Pydantic to V2, but use V1 API
- Host: GitHub
- URL: https://github.com/peter554/codemodpydanticv1
- Owner: Peter554
- Created: 2023-10-22T12:34:52.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-13T09:49:27.000Z (over 2 years ago)
- Last Synced: 2024-10-19T11:28:39.250Z (over 1 year ago)
- Topics: codemod, libcst, pydantic, pydantic-v2
- Language: Python
- Homepage:
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# codemodpydanticv1
[](https://github.com/Peter554/codemodpydanticv1/actions/workflows/ci.yml)
A small codemod tool to upgrade pydantic from V1 to V2, but still use the V1 API.
Pydantic V2 exposes the V1 API. By using the V1 API we can be sure nothing
is being broken by the package upgrade, and usage can then gradually be migrated
across to the V2 API.
```sh
pip install codemodpydanticv1
codemodpydanticv1
```
Using [ripgrep](https://github.com/BurntSushi/ripgrep) and looping over files:
```sh
for file in $(rg pydantic -g '*.py' -l); do
echo $file
codemodpydanticv1 $file
done
```