From aa58d7528d9c97ea10fff8f0c738be94f6f6383a Mon Sep 17 00:00:00 2001 From: Subhadeep Das Date: Wed, 10 Jul 2024 10:06:19 +0530 Subject: [PATCH] Modifef other references to pydantic --- docs/providers/configuration.rst | 2 +- examples/providers/configuration/configuration_pydantic.py | 2 +- examples/providers/configuration/configuration_pydantic_init.py | 2 +- src/dependency_injector/providers.pyx | 2 +- tests/typing/configuration.py | 2 +- tests/unit/providers/configuration/test_from_pydantic_py36.py | 2 +- .../configuration/test_pydantic_settings_in_init_py36.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/providers/configuration.rst b/docs/providers/configuration.rst index 3e4696f1..5b7fcbf5 100644 --- a/docs/providers/configuration.rst +++ b/docs/providers/configuration.rst @@ -223,7 +223,7 @@ the container will call ``config.from_pydantic()`` automatically: or install ``pydantic`` directly:: - pip install pydantic + pip install pydantic-settings *Don't forget to mirror the changes in the requirements file.* diff --git a/examples/providers/configuration/configuration_pydantic.py b/examples/providers/configuration/configuration_pydantic.py index aaed5d26..eeadd271 100644 --- a/examples/providers/configuration/configuration_pydantic.py +++ b/examples/providers/configuration/configuration_pydantic.py @@ -3,7 +3,7 @@ import os from dependency_injector import containers, providers -from pydantic import BaseSettings, Field +from pydantic_settings import BaseSettings, Field # Emulate environment variables os.environ["AWS_ACCESS_KEY_ID"] = "KEY" diff --git a/examples/providers/configuration/configuration_pydantic_init.py b/examples/providers/configuration/configuration_pydantic_init.py index f904d9df..cfc34f7b 100644 --- a/examples/providers/configuration/configuration_pydantic_init.py +++ b/examples/providers/configuration/configuration_pydantic_init.py @@ -3,7 +3,7 @@ import os from dependency_injector import containers, providers -from pydantic import BaseSettings, Field +from pydantic_settings import BaseSettings, Field # Emulate environment variables os.environ["AWS_ACCESS_KEY_ID"] = "KEY" diff --git a/src/dependency_injector/providers.pyx b/src/dependency_injector/providers.pyx index 8208ad63..5bc50334 100644 --- a/src/dependency_injector/providers.pyx +++ b/src/dependency_injector/providers.pyx @@ -49,7 +49,7 @@ except ImportError: yaml = None try: - import pydantic + import pydantic_settings as pydantic except ImportError: pydantic = None diff --git a/tests/typing/configuration.py b/tests/typing/configuration.py index 386689d2..5a0d3d28 100644 --- a/tests/typing/configuration.py +++ b/tests/typing/configuration.py @@ -1,7 +1,7 @@ from pathlib import Path from dependency_injector import providers -from pydantic import BaseSettings as PydanticSettings +from pydantic_settings import BaseSettings as PydanticSettings # Test 1: to check the getattr diff --git a/tests/unit/providers/configuration/test_from_pydantic_py36.py b/tests/unit/providers/configuration/test_from_pydantic_py36.py index f5a2c97e..5fc6a64f 100644 --- a/tests/unit/providers/configuration/test_from_pydantic_py36.py +++ b/tests/unit/providers/configuration/test_from_pydantic_py36.py @@ -1,6 +1,6 @@ """Configuration.from_pydantic() tests.""" -import pydantic +import pydantic_settings as pydantic from dependency_injector import providers, errors from pytest import fixture, mark, raises diff --git a/tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py b/tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py index 08234f15..5d791e2b 100644 --- a/tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py +++ b/tests/unit/providers/configuration/test_pydantic_settings_in_init_py36.py @@ -1,6 +1,6 @@ """Configuration.from_pydantic() tests.""" -import pydantic +import pydantic_settings as pydantic from dependency_injector import providers from pytest import fixture, mark, raises