Skip to content

Commit 3bd3938

Browse files
Use new Pydantic v1 backdoor (#295)
* Use new Pydantic v1 backdoor * Loosen version constraint * Use new QCArchive
1 parent 9553263 commit 3bd3938

File tree

4 files changed

+33
-53
lines changed

4 files changed

+33
-53
lines changed

devtools/conda-envs/basic.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ dependencies:
2424

2525
- qcengine >=0.25
2626
- qcelemental >=0.25.1
27-
- qcfractal >=0.54
27+
- qcfractal >=0.56
2828
- qcarchivetesting
2929
- qcportal
3030

@@ -39,7 +39,7 @@ dependencies:
3939

4040
- openff-toolkit
4141
- openff-units >=0.2.1
42-
- pydantic
42+
- pydantic >1.10.17,<3
4343
- pyyaml
4444
- torsiondrive
4545
- basis_set_exchange

devtools/conda-envs/psi4.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222

2323
- qcengine >=0.25
2424
- qcelemental >=0.25.1
25-
- qcfractal >=0.54
25+
- qcfractal >=0.56
2626
- qcarchivetesting
2727
- qcportal
2828

@@ -36,7 +36,7 @@ dependencies:
3636
- openff-toolkit-base
3737
- openff-units >=0.2.1
3838
- rdkit
39-
- pydantic
39+
- pydantic >1.10.17,<3
4040
- pyyaml
4141
- torsiondrive
4242
- basis_set_exchange

openff/qcsubmit/_pydantic.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
"""Centralized shim for Pydantic v1/v2 compatible import."""
22

3-
try:
4-
from pydantic.v1 import (
5-
BaseModel,
6-
Field,
7-
PrivateAttr,
8-
ValidationError,
9-
constr,
10-
root_validator,
11-
validator,
12-
)
13-
except ImportError:
14-
from pydantic import (
15-
BaseModel,
16-
Field,
17-
PrivateAttr,
18-
ValidationError,
19-
constr,
20-
root_validator,
21-
validator,
22-
)
3+
from pydantic.v1 import (
4+
BaseModel,
5+
Field,
6+
HttpUrl,
7+
PositiveFloat,
8+
PositiveInt,
9+
PrivateAttr,
10+
StrictBool,
11+
StrictFloat,
12+
StrictInt,
13+
StrictStr,
14+
ValidationError,
15+
constr,
16+
root_validator,
17+
validator,
18+
)

openff/qcsubmit/common_structures.py

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,26 @@
3030
from qcelemental.models.results import WavefunctionProtocolEnum
3131
from qcportal.singlepoint import SinglepointDriver
3232

33+
from openff.qcsubmit._pydantic import (
34+
BaseModel,
35+
Field,
36+
HttpUrl,
37+
PositiveFloat,
38+
PositiveInt,
39+
StrictBool,
40+
StrictFloat,
41+
StrictInt,
42+
StrictStr,
43+
constr,
44+
validator,
45+
)
3346
from openff.qcsubmit.exceptions import (
3447
DatasetInputError,
3548
PCMSettingError,
3649
QCSpecificationError,
3750
)
3851
from openff.qcsubmit.utils.smirnoff import split_openff_molecule
3952

40-
try:
41-
from pydantic.v1 import (
42-
BaseModel,
43-
Field,
44-
HttpUrl,
45-
PositiveFloat,
46-
PositiveInt,
47-
StrictBool,
48-
StrictFloat,
49-
StrictInt,
50-
StrictStr,
51-
constr,
52-
validator,
53-
)
54-
except ImportError:
55-
from pydantic import (
56-
BaseModel,
57-
Field,
58-
HttpUrl,
59-
PositiveFloat,
60-
PositiveInt,
61-
StrictBool,
62-
StrictFloat,
63-
StrictInt,
64-
StrictStr,
65-
constr,
66-
validator,
67-
)
68-
6953
if TYPE_CHECKING:
7054
DictStrAny = Dict[str, Any]
7155
IntStr = Union[int, str]

0 commit comments

Comments
 (0)