Skip to content

Commit

Permalink
Allow pydantic v2 using transitional v1 support (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianeboyd authored Aug 4, 2023
1 parent 4d6c5b4 commit b70bf6a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repos:
additional_dependencies:
- "types-requests"
- "types-setuptools"
- "pydantic==1.10.10"
- "pydantic"

- repo: https://github.com/pycqa/isort
rev: 5.12.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cloudpathlib>=0.7.0,<0.16.0
smart-open>=5.2.1,<7.0.0
# Third party dependencies
requests>=2.13.0,<3.0.0
pydantic>=1.7.4,!=1.8,!=1.8.1,<1.11.0
pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0
# Official Python utilities
packaging>=20.0
typing_extensions>=3.7.4.1,<4.5.0; python_version < "3.8"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ install_requires =
cloudpathlib>=0.7.0,<0.16.0
smart-open>=5.2.1,<7.0.0
requests>=2.13.0,<3.0.0
pydantic>=1.7.4,!=1.8,!=1.8.1,<1.11.0
pydantic>=1.7.4,!=1.8,!=1.8.1,<3.0.0


[options.entry_points]
Expand Down
6 changes: 5 additions & 1 deletion weasel/schemas.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from collections import defaultdict
from typing import Any, Dict, List, Optional, Type, Union

from pydantic import BaseModel, Field, StrictStr, ValidationError, root_validator
try:
from pydantic.v1 import BaseModel, Field, StrictStr, ValidationError, root_validator
except ImportError:
from pydantic import BaseModel, Field, StrictStr, ValidationError, root_validator # type: ignore

from wasabi import msg


Expand Down

0 comments on commit b70bf6a

Please sign in to comment.