poetry lock the experimental package. (#9478)

This commit is contained in:
Predrag Gruevski
2023-08-22 14:09:35 -04:00
committed by GitHub
parent 65e893b9cd
commit d564ec944c
6 changed files with 397 additions and 484 deletions

View File

@@ -1,3 +1,4 @@
import typing
from importlib import metadata
## Create namespaces for pydantic v1 and v2.
@@ -11,11 +12,19 @@ from importlib import metadata
# unambiguously uses either v1 or v2 API.
# * This change is easier to roll out and roll back.
try:
from pydantic.v1 import * # noqa: F403
except ImportError:
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need
# to replace this with `from pydantic.v1 import *`.
if typing.TYPE_CHECKING:
from pydantic import * # noqa: F403
else:
try:
from pydantic.v1 import * # noqa: F403
except ImportError:
from pydantic import * # noqa: F403
try:
_PYDANTIC_MAJOR_VERSION: int = int(metadata.version("pydantic").split(".")[0])

View File

@@ -1,4 +1,15 @@
try:
from pydantic.v1.dataclasses import * # noqa: F403
except ImportError:
import typing
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need to
# replace this with `from pydantic.v1.dataclasses import *`.
if typing.TYPE_CHECKING:
from pydantic.dataclasses import * # noqa: F403
else:
try:
from pydantic.v1.dataclasses import * # noqa: F403
except ImportError:
from pydantic.dataclasses import * # noqa: F403

View File

@@ -1,4 +1,15 @@
try:
from pydantic.v1.main import * # noqa: F403
except ImportError:
import typing
# It's currently impossible to support mypy for both pydantic v1 and v2 at once:
# https://github.com/pydantic/pydantic/issues/6022
#
# In the lint environment, pydantic is currently v1.
# When we upgrade it to pydantic v2, we'll need
# to replace this with `from pydantic.v1.main import *`.
if typing.TYPE_CHECKING:
from pydantic.main import * # noqa: F403
else:
try:
from pydantic.v1.main import * # noqa: F403
except ImportError:
from pydantic.main import * # noqa: F403