We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is your feature request related to a problem? Please describe
Use Pydantic V2 BaseModel class rather than V1 (maintenance purpose only).
BaseModel
Describe the solution you'd like
Migrate referring the Pydantic V2 Migration Guide.
Describe alternatives you've considered
Use Pydantic V2/V1 backward compatibility:
try: from pydantic import v1 as pydantic except ImportError: import pydantic # type: ignore
The text was updated successfully, but these errors were encountered:
Hello, what is the goal here? should final code match requirements for both pydantic v1 and v2 or switch to v2 completely (impacting dependencies)?
Sorry, something went wrong.
Hi, Good question. Answer is the first:
"final code match requirements for both pydantic v1 and v2"
Currently, we are using Pydantic v2's backward compatibility of v1:
arta/src/arta/models.py
Lines 8 to 11 in b7b8938
The goal here is to implement the Pydantic models using Pydantic v2 but still compatible with v1.
A first idea (inspired by FastAPI) but not tested could be something like (code is an example):
from pydantic import BaseModel from pydantic.version import VERSION PYDANTIC_V1: bool = VERSION.startswith("1.") if PYDANTIC_V1: class MyModel(BaseModel): attr_1: str class Config: extra = "allow" else: from pydantic import ConfigDict class MyModel(BaseModel): attr_1: str model_config = ConfigDict(extra="allow")
Hello, thanks for explaining I'll try to implement it. And yes, probably, there will be a lot of ugly if..else here and there
No branches or pull requests
Is your feature request related to a problem? Please describe
Use Pydantic V2
BaseModel
class rather than V1 (maintenance purpose only).Describe the solution you'd like
Migrate referring the Pydantic V2 Migration Guide.
Describe alternatives you've considered
Use Pydantic V2/V1 backward compatibility:
The text was updated successfully, but these errors were encountered: