Skip to content

Commit

Permalink
Add pydantic.v1 namespace to Pydantic v1 (#9042)
Browse files Browse the repository at this point in the history
Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
  • Loading branch information
exs-dmiketa and sydney-runkle committed Mar 25, 2024
1 parent 9dac716 commit aa98b58
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
116 changes: 116 additions & 0 deletions pydantic/v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# NOTE This file aliases the pydantic namespace as pydantic.v1 for smoother v1 -> v2 transition
# flake8: noqa
from pydantic import *

# WARNING __all__ from .errors is not included here, it will be removed as an export here in v2
# please use "from pydantic.errors import ..." instead
__all__ = [
# annotated types utils
"create_model_from_namedtuple",
"create_model_from_typeddict",
# dataclasses
"dataclasses",
# class_validators
"root_validator",
"validator",
# config
"BaseConfig",
"ConfigDict",
"Extra",
# decorator
"validate_arguments",
# env_settings
"BaseSettings",
# error_wrappers
"ValidationError",
# fields
"Field",
"Required",
# main
"BaseModel",
"create_model",
"validate_model",
# network
"AnyUrl",
"AnyHttpUrl",
"FileUrl",
"HttpUrl",
"stricturl",
"EmailStr",
"NameEmail",
"IPvAnyAddress",
"IPvAnyInterface",
"IPvAnyNetwork",
"PostgresDsn",
"CockroachDsn",
"AmqpDsn",
"RedisDsn",
"MongoDsn",
"KafkaDsn",
"validate_email",
# parse
"Protocol",
# tools
"parse_file_as",
"parse_obj_as",
"parse_raw_as",
"schema_of",
"schema_json_of",
# types
"NoneStr",
"NoneBytes",
"StrBytes",
"NoneStrBytes",
"StrictStr",
"ConstrainedBytes",
"conbytes",
"ConstrainedList",
"conlist",
"ConstrainedSet",
"conset",
"ConstrainedFrozenSet",
"confrozenset",
"ConstrainedStr",
"constr",
"PyObject",
"ConstrainedInt",
"conint",
"PositiveInt",
"NegativeInt",
"NonNegativeInt",
"NonPositiveInt",
"ConstrainedFloat",
"confloat",
"PositiveFloat",
"NegativeFloat",
"NonNegativeFloat",
"NonPositiveFloat",
"FiniteFloat",
"ConstrainedDecimal",
"condecimal",
"ConstrainedDate",
"condate",
"UUID1",
"UUID3",
"UUID4",
"UUID5",
"FilePath",
"DirectoryPath",
"Json",
"JsonWrapper",
"SecretField",
"SecretStr",
"SecretBytes",
"StrictBool",
"StrictBytes",
"StrictInt",
"StrictFloat",
"PaymentCardNumber",
"PrivateAttr",
"ByteSize",
"PastDate",
"FutureDate",
# version
"compiled",
"VERSION",
]
2 changes: 2 additions & 0 deletions tests/test_v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_imports() -> None:
from pydantic.v1 import BaseModel, dataclasses # noqa: F401

0 comments on commit aa98b58

Please sign in to comment.