From 3fe4156526866cfee7372084e52626150bac9280 Mon Sep 17 00:00:00 2001 From: Adam Azzam <33043305+AAAZZAM@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:22:59 -0400 Subject: [PATCH 1/2] fix imports --- pyproject.toml | 1 - src/marvin/_compat.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 331bfaa34..529c8a32a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ dependencies = [ "jsonpatch>=1.33", "openai>=0.27.8", "pydantic[dotenv]>=1.10.7", - "pydantic-settings>=2.0.0", "rich>=12", "tiktoken>=0.4.0", "typer>=0.9.0", diff --git a/src/marvin/_compat.py b/src/marvin/_compat.py index 8f86aa993..1e1761840 100644 --- a/src/marvin/_compat.py +++ b/src/marvin/_compat.py @@ -19,8 +19,12 @@ if PYDANTIC_V2: from pydantic.v1 import validate_arguments # noqa # type: ignore - from pydantic_settings import BaseSettings # noqa # type: ignore - from pydantic_settings import SettingsConfigDict # noqa # type: ignore + + try: + from pydantic_settings import BaseSettings # noqa # type: ignore + from pydantic_settings import SettingsConfigDict # noqa # type: ignore + except Exception as e: + print('Please install "pydantic-settings" to marvin with Pydantic v2.', e) from pydantic import field_validator # noqa # type: ignore else: From 19fd898717fbc0eaff7fe14e9f82ebb45d14399a Mon Sep 17 00:00:00 2001 From: Adam Azzam <33043305+AAAZZAM@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:29:00 -0400 Subject: [PATCH 2/2] add settings to [test] --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 529c8a32a..f5405dbb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,7 @@ tests = [ "pytest-rerunfailures>=10,<13", "pytest-sugar~=0.9", "pytest~=7.3.1", + "pydantic-settings>=2.0.0", ] framework = [ "aiosqlite>=0.19.0",