10000 Add pydantic.v1 namespace to Pydantic v1 (#9042) · pydantic/pydantic@aa98b58 · GitHub
[go: up one dir, main page]

Skip to content

Commit aa98b58

Browse files
Add pydantic.v1 namespace to Pydantic v1 (#9042)
Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com>
1 parent 9dac716 commit aa98b58

File tree

2 files changed

+118
-0
lines changed

2 files changed

+118
-0
lines changed

pydantic/v1.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# NOTE This file aliases the pydantic namespace as pydantic.v1 for smoother v1 -> v2 transition
2+
# flake8: noqa
3+
from pydantic import *
4+
5+
# WARNING __all__ from .errors is not included here, it will be removed as an export here in v2
6+
# please use "from pydantic.errors import ..." instead
7+
__all__ = [
8+
# annotated types utils
9+
"create_model_from_namedtuple",
10+
"create_model_from_typeddict",
11+
# dataclasses
12+
"dataclasses",
13+
# class_validators
14+
"root_validator",
15+
"validator",
16+
# config
17+
"BaseConfig",
18+
"ConfigDict",
19+
"Extra",
20+
# decorator
21+
"validate_arguments",
22+
# env_settings
23+
"BaseSettings",
24+
# error_wrappers
25+
"ValidationError",
26+
# fields
27+
"Field",
28+
"Required",
29+
# main
30+
"BaseModel",
31+
"create_model",
32+
"validate_model",
33+
# network
34+
"AnyUrl",
35+
"AnyHttpUrl",
36+
"FileUrl",
37+
"HttpUrl",
38+
"stricturl",
39+
"EmailStr",
40+
"NameEmail",
41+
"IPvAnyAddress",
42+
"IPvAnyInterface",
43+
"IPvAnyNetwork",
44+
"PostgresDsn",
45+
"CockroachDsn",
46+
"AmqpDsn",
47+
"RedisDsn",
48+
"MongoDsn",
49+
"KafkaDsn",
50+
"validate_email",
51+
# parse
52+
"Protocol",
53+
# tools
54+
"parse_file_as",
55+
"parse_obj_as",
56+
"parse_raw_as",
57+
"schema_of",
58+
"schema_json_of",
59+
# types
60+
"NoneStr",
61+
"NoneBytes",
62+
"StrBytes",
63+
"NoneStrBytes",
64+
"StrictStr",
65+
"ConstrainedBytes",
66+
"conbytes",
67+
"ConstrainedList",
68+
"conlist",
69+
"ConstrainedSet",
70+
"conset",
71+
"ConstrainedFrozenSet",
72+
"confrozenset",
73+
"ConstrainedStr",
74+
"constr",
75+
"PyObject",
76+
"ConstrainedInt",
77+
"conint",
78+
"PositiveInt",
79+
"NegativeInt",
80+
"NonNegativeInt",
81+
"NonPositiveInt",
82+
"ConstrainedFloat",
83+
"confloat",
84+
"PositiveFloat",
85+
"NegativeFloat",
86+
"NonNegativeFloat",
87+
"NonPositiveFloat",
88+
"FiniteFloat",
89+
"ConstrainedDecimal",
90+
"condecimal",
91+
"ConstrainedDate",
92+
"condate",
93+
"UUID1",
94+
"UUID3",
95+
"UUID4",
96+
"UUID5",
97+
"FilePath",
98+
"DirectoryPath",
99+
"Json",
100+
"JsonWrapper",
101+
"SecretField",
102+
"SecretStr",
103+
"SecretBytes",
104+
"StrictBool",
105+
"StrictBytes",
106+
"StrictInt",
107+
"StrictFloat",
108+
"PaymentCardNumber",
109+
"PrivateAttr",
110+
"ByteSize",
111+
"PastDate",
112+
"FutureDate",
113+
# version
114+
"compiled",
115+
"VERSION",
116+
]

tests/test_v1.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_imports() -> None:
2+
from pydantic.v1 import BaseModel, dataclasses # noqa: F401

0 commit comments

Comments
 (0)
0