From c1b956cb27bf95e1481f0de2b85af1da265ebf42 Mon Sep 17 00:00:00 2001 From: Bodong Yang <86948717+Bodong-Yang@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:42:02 +0900 Subject: [PATCH] deps: bump pydantic to >=2.10,<3 (#451) This PR bumps pydantic version to >=2.10,<3. With pydantic >=2.10, typing issues related to IPAddress and URL has been resolved, update the ecu_info and proxy_info modules accordingly. --- pyproject.toml | 2 +- requirements.txt | 2 +- src/otaclient/configs/_ecu_info.py | 2 +- src/otaclient/configs/_proxy_info.py | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b62a7a683..a5856ee38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ dependencies = [ "grpcio>=1.53.2,<1.69", "multidict<7.0,>=4.5", "protobuf>=4.21.12,<5.29", - "pydantic<3,>=2.6", + "pydantic<3,>=2.10", "pydantic-settings<3,>=2.3", "pyyaml<7,>=6.0.1", "requests<2.33,>=2.32", diff --git a/requirements.txt b/requirements.txt index 693f5be85..9aac3bb4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ cryptography>=43.0.1,<45 grpcio>=1.53.2,<1.69 multidict<7.0,>=4.5 protobuf>=4.21.12,<5.29 -pydantic<3,>=2.6 +pydantic<3,>=2.10 pydantic-settings<3,>=2.3 pyyaml<7,>=6.0.1 requests<2.33,>=2.32 diff --git a/src/otaclient/configs/_ecu_info.py b/src/otaclient/configs/_ecu_info.py index 20c8dfe7d..c1ea4ad10 100644 --- a/src/otaclient/configs/_ecu_info.py +++ b/src/otaclient/configs/_ecu_info.py @@ -91,7 +91,7 @@ class ECUInfo(BaseFixedConfig): # NOTE(20240327): set the default as literal for now, in the future # when app_configs are fully backported this will be replaced by # service_cfg.DEFAULT_SERVER_ADDRESS - ip_addr: IPvAnyAddress = Field(default="127.0.0.1") + ip_addr: IPvAnyAddress = IPvAnyAddress("127.0.0.1") bootloader: Annotated[ BootloaderType, BeforeValidator(gen_strenum_validator(BootloaderType)), diff --git a/src/otaclient/configs/_proxy_info.py b/src/otaclient/configs/_proxy_info.py index f3e49da24..4716ce09a 100644 --- a/src/otaclient/configs/_proxy_info.py +++ b/src/otaclient/configs/_proxy_info.py @@ -24,7 +24,6 @@ import yaml from pydantic import AliasChoices, AnyHttpUrl, Field, IPvAnyAddress -from pydantic_core import Url from otaclient.configs._common import BaseFixedConfig from otaclient_common.typing import NetworkPort, StrOrPath @@ -63,7 +62,7 @@ class ProxyInfo(BaseFixedConfig): ) # NOTE(20240327): set the default as literal for now, in the future # this will be app_cfg.OTA_PROXY_LISTEN_ADDRESS and app_cfg.OTA_PROXY_LISTEN_PORT. - local_ota_proxy_listen_addr: IPvAnyAddress = Field(default="0.0.0.0") + local_ota_proxy_listen_addr: IPvAnyAddress = IPvAnyAddress("0.0.0.0") local_ota_proxy_listen_port: NetworkPort = 8082 # NOTE: this field not presented in v2.5.4, # for current implementation, it should be default to True. @@ -76,7 +75,7 @@ class ProxyInfo(BaseFixedConfig): # NOTE: when logging_server is not configured, it implicitly means the logging server # is located at localhost. # check roles/ota_client/templates/run.sh.j2 in ecu_setup repo. - logging_server: Optional[AnyHttpUrl] = Url( + logging_server: Optional[AnyHttpUrl] = AnyHttpUrl( f"http://127.0.0.1:{LOGGING_SERVER_PORT}" )