Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility to pydantic >= 2 #56

Closed
bolau opened this issue Dec 22, 2023 · 7 comments
Closed

Compatibility to pydantic >= 2 #56

bolau opened this issue Dec 22, 2023 · 7 comments

Comments

@bolau
Copy link

bolau commented Dec 22, 2023

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

@acederberg
Copy link

acederberg commented Jan 3, 2024

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

@mpkocher
Copy link
Owner

mpkocher commented Jan 8, 2024

I'll look into supporting Pydantic 2.

What is the minimum version of 2 (>= 2.5.x?) that should be supported?

@acederberg
Copy link

@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

@ddorian
Copy link

ddorian commented Jan 9, 2024

@acederberg you can just use the v1 namespace pydantic/pydantic#5771

@mpkocher
Copy link
Owner

@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.

pydantic/pydantic-settings#209

@yushaer
Copy link

yushaer commented Feb 26, 2024

@mpkocher are you planning on adding support for pydantic - 2 in the near future?

@mpkocher
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants