From 21c51d475846e4fcde5599103fd7f8d9ebf6987f Mon Sep 17 00:00:00 2001 From: Automated Action Date: Wed, 18 Jun 2025 09:33:51 +0000 Subject: [PATCH] Fix Pydantic validation error by adding ClassVar annotation to DB_DIR --- app/core/config.py | 3 ++- migrations/env.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 13d382e..efd33f6 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -1,4 +1,5 @@ from pathlib import Path +from typing import ClassVar from pydantic_settings import BaseSettings, SettingsConfigDict @@ -18,7 +19,7 @@ class Settings(BaseSettings): ACCESS_TOKEN_EXPIRE_MINUTES: int = 30 # Database settings - DB_DIR = Path("/app") / "storage" / "db" + DB_DIR: ClassVar[Path] = Path("/app") / "storage" / "db" SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite" diff --git a/migrations/env.py b/migrations/env.py index 4ca63e0..8695f1c 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -1,6 +1,6 @@ import sys -from pathlib import Path from logging.config import fileConfig +from pathlib import Path from alembic import context from sqlalchemy import engine_from_config, pool @@ -9,7 +9,8 @@ from sqlalchemy import engine_from_config, pool project_root = Path(__file__).parent.parent sys.path.insert(0, str(project_root)) -from app.db.base import Base +# Import after adding to path to avoid ModuleNotFoundError +from app.db.base import Base # noqa: E402 # this is the Alembic Config object, which provides # access to the values within the .ini file in use.