Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use Pydantic v1 API, test using v1 and v2 #358

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
51 changes: 16 additions & 35 deletions openff/bespokefit/_pydantic.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
"""A set of common utilities and types useful for building pydantic models."""

import numpy

try:
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,
)
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 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,
)
from pydantic.v1.generics import GenericModel


class BaseModel(PydanticBaseModel):
Expand Down
Loading