-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add v1 namespace * add test * back to star * update module doc
- Loading branch information
1 parent
c8b911b
commit 33b2662
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"BaseModel", | ||
] | ||
|
||
|
||
from ._shared import PYDANTIC2 | ||
|
||
if TYPE_CHECKING: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"""This module is a try/except pass-through for the pydantic.v1 namespace. | ||
The pydantic.v1 namespace was added in pydantic v2. It contains the entire | ||
pydantic v1 package. For packages that would like to unpin their 'pydantic<2' | ||
dependency *without* needing to update all of their code to use the pydantic v2 api, | ||
this provides a simple way to delay that update. | ||
This is different from the goal of pydantic_compat on the whole, which is to provide | ||
an API translation layer that allows you to actually use pydantic v2 features | ||
(e.g. rust-backed speed, etc...) while also being compatible with packages that pin | ||
pydantic<2. | ||
""" | ||
try: | ||
from pydantic.v1 import * # noqa | ||
except ImportError: | ||
from pydantic import * # type: ignore # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters