pydantic-cli
pydantic-cli copied to clipboard
Compatibility to pydantic >= 2
Hi, I use fastapi and pydantic-cli in the same project. I would like to use pydantic in a recent version, but pydantic-cli restricts it to <2 in the requirements.txt. Do you plan to accomodate the newer versions at some point? Best, Boris
Hi!
I'd like to second this ask. It looks like there is something in #54 by the dependabot, though it appears to have failed CI and nothing was done after (It makes sense that this would fail, pydantic 2 has many breaking changes). I was looking at this tool as it would do what I want typer
to do (to turn pydantic
models into flags). Is there any way I could help @mpkocher?
Best, Adrian
I'll look into supporting Pydantic 2.
What is the minimum version of 2 (>= 2.5.x
?) that should be supported?
@mpkocher 2.4.0
seams to be the first minor release with new features, however I see no reason to just support all of v2. So far most of the changes aren't big from what I can tell (in terms of user experience, and in terms of breaking changes I think there are none). You might find the improved deprecation notices in the more recent releases to be helpful in developing though
@acederberg you can just use the v1 namespace https://github.com/pydantic/pydantic/issues/5771
@bolau and @acederberg Perhaps you should considering following the effort in the pydantic-settings
repo for a Pydantic CLI interface that uses Pydantic 2.
It does look like that project has different requirements/goals than pydantic-cli
. However, a CLI interface in pydantic-settings
does look promising and it could have a larger user base and better documentation than pydantic-cli
.
https://github.com/pydantic/pydantic-settings/issues/209
@mpkocher are you planning on adding support for pydantic - 2 in the near future?
Support for Pydantic v2 has been added.
This has created several backwards incompatible changes. The new API should be more ergonomic and there should be less of a friction point between non-subcommands and subcommand tools.
There's also been some build issues with moving to pyproject.toml that have been resolved. Installing from pypi should work as expected now.