From 2ea89c98f5efd635ac39aa88992ad624fec61156 Mon Sep 17 00:00:00 2001 From: Automated Action Date: Tue, 27 May 2025 19:01:24 +0000 Subject: [PATCH] Fix dependency conflicts and update to FastAPI 0.100.x - Update FastAPI from 0.96.x to 0.100.x to support Pydantic 2.x - Update uvicorn from 0.22.x to 0.23.x for compatibility - Update Pydantic model configurations to use model_config instead of Config class - Keep Pydantic 2.x version as required by the project --- app/schemas/news.py | 25 +++++++++++++++---------- app/schemas/user.py | 5 +++-- requirements.txt | 4 ++-- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/schemas/news.py b/app/schemas/news.py index 4d82d2d..0f64ba1 100644 --- a/app/schemas/news.py +++ b/app/schemas/news.py @@ -18,8 +18,9 @@ class NewsSource(NewsSourceBase): created_at: datetime updated_at: datetime - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } class NewsCategoryBase(BaseModel): @@ -35,8 +36,9 @@ class NewsCategory(NewsCategoryBase): created_at: datetime updated_at: datetime - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } class NewsArticleBase(BaseModel): @@ -72,8 +74,9 @@ class NewsArticle(NewsArticleBase): source: Optional[NewsSource] = None category: Optional[NewsCategory] = None - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } class SavedArticleBase(BaseModel): @@ -92,8 +95,9 @@ class SavedArticle(SavedArticleBase): updated_at: datetime article: Optional[NewsArticle] = None - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } class UserPreferenceBase(BaseModel): @@ -118,8 +122,9 @@ class UserPreference(UserPreferenceBase): created_at: datetime updated_at: datetime - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } # For API responses diff --git a/app/schemas/user.py b/app/schemas/user.py index 543a995..888614e 100644 --- a/app/schemas/user.py +++ b/app/schemas/user.py @@ -25,8 +25,9 @@ class UserInDBBase(UserBase): created_at: Optional[datetime] = None updated_at: Optional[datetime] = None - class Config: - from_attributes = True + model_config = { + "from_attributes": True + } class User(UserInDBBase): diff --git a/requirements.txt b/requirements.txt index 675ddc6..6e2ac8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -fastapi>=0.96.0,<0.97.0 -uvicorn>=0.22.0,<0.23.0 +fastapi>=0.100.0,<0.101.0 +uvicorn>=0.23.0,<0.24.0 pydantic>=2.0.0,<3.0.0 pydantic-settings>=2.0.0,<3.0.0 sqlalchemy>=2.0.0,<3.0.0