From 45c788c4c3360293293b8b65ab8107bdca6ed328 Mon Sep 17 00:00:00 2001 From: Jeff Wagner Date: Thu, 5 Sep 2024 11:50:45 -0700 Subject: [PATCH 1/2] test on pydantic 2 try with interchange-rc label packages unpin other openff deps actually order channels correctly remove interchange-rc channel Revert toolkit change Just use Pydantic v1 API, test both versions --- .github/workflows/CI.yaml | 2 +- openff/bespokefit/_pydantic.py | 26 ++++---------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index a9acca2b..646790c4 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -25,7 +25,7 @@ jobs: matrix: os: [ubuntu-latest, macOS-latest] python-version: ["3.10", "3.11"] - pydantic-version: ["1"] + pydantic-version: ["1", "2"] openeye: [true, false] integration: [true] diff --git a/openff/bespokefit/_pydantic.py b/openff/bespokefit/_pydantic.py index 3eb425b3..6428e37c 100644 --- a/openff/bespokefit/_pydantic.py +++ b/openff/bespokefit/_pydantic.py @@ -2,9 +2,8 @@ import numpy -try: - from pydantic.v1 import BaseModel as PydanticBaseModel - from pydantic.v1 import ( +from pydantic.v1 import BaseModel as PydanticBaseModel +from pydantic.v1 import ( BaseSettings, Extra, Field, @@ -17,25 +16,8 @@ parse_obj_as, parse_raw_as, validator, - ) - from pydantic.v1.generics import GenericModel -except ImportError: - from pydantic import BaseModel as PydanticBaseModel - from pydantic import ( # noqa - BaseSettings, - Extra, - Field, - PositiveFloat, - PositiveInt, - ValidationError, - conint, - conlist, - parse_file_as, - parse_obj_as, - parse_raw_as, - validator, - ) - from pydantic.generics import GenericModel # noqa +) +from pydantic.v1.generics import GenericModel class BaseModel(PydanticBaseModel): From 3cb1d6571edc0faf934d10e74b1863ed7120ad3c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:31:49 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openff/bespokefit/_pydantic.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/openff/bespokefit/_pydantic.py b/openff/bespokefit/_pydantic.py index 6428e37c..d2f82166 100644 --- a/openff/bespokefit/_pydantic.py +++ b/openff/bespokefit/_pydantic.py @@ -1,21 +1,20 @@ """A set of common utilities and types useful for building pydantic models.""" import numpy - from pydantic.v1 import BaseModel as PydanticBaseModel from pydantic.v1 import ( - BaseSettings, - Extra, - Field, - PositiveFloat, - PositiveInt, - ValidationError, - conint, - conlist, - parse_file_as, - parse_obj_as, - parse_raw_as, - validator, + BaseSettings, + Extra, + Field, + PositiveFloat, + PositiveInt, + ValidationError, + conint, + conlist, + parse_file_as, + parse_obj_as, + parse_raw_as, + validator, ) from pydantic.v1.generics import GenericModel