Skip to content

Commit

Permalink
add compat for pydantic v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Dec 10, 2023
1 parent a83d5ea commit c77860d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions menuinst/_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
from pprint import pprint
from typing import Dict, List, Literal, Optional, Union

from pydantic import BaseModel as _BaseModel
from pydantic import Field, conlist, constr
try:
from pydantic.v1 import BaseModel as _BaseModel
from pydantic.v1 import Field, conlist, constr
except ImportError:
# pydantic v1
from pydantic import BaseModel as _BaseModel
from pydantic import Field, conlist, constr


log = getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ test:
- conda
- pytest
- pytest-cov
- pydantic <2.0a0
- pydantic
- hypothesis
- hypothesis-jsonschema
source_files:
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python
pip
conda
pydantic<2.0a0
pydantic
pytest
pytest-cov
hypothesis
Expand Down

0 comments on commit c77860d

Please sign in to comment.