From 856ea182b85b68632caba132e1faf28aa59ea588 Mon Sep 17 00:00:00 2001 From: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> Date: Thu, 8 Feb 2024 10:31:25 -0600 Subject: [PATCH 1/4] patch fix for mypy (#8765) --- pydantic/mypy.py | 2 +- tests/pyright/pyright_example.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pydantic/mypy.py b/pydantic/mypy.py index 1d6d5ae283d..0262120f1bf 100644 --- a/pydantic/mypy.py +++ b/pydantic/mypy.py @@ -65,7 +65,7 @@ from mypy.util import get_unique_redefinition_name from mypy.version import __version__ as mypy_version -from pydantic.utils import is_valid_field +from .utils import is_valid_field try: from mypy.types import TypeVarDef # type: ignore[attr-defined] diff --git a/tests/pyright/pyright_example.py b/tests/pyright/pyright_example.py index 0819afc3c4b..b2a77eb65d7 100644 --- a/tests/pyright/pyright_example.py +++ b/tests/pyright/pyright_example.py @@ -35,4 +35,4 @@ class Settings(BaseSettings): s1 = Settings.parse_obj({}) -s2 = Settings() # pyright: ignore[reportGeneralTypeIssues] +s2 = Settings() # pyright: ignore[reportCallIssue] From 9dac7169e433125c957874b578c211aed789ae8e Mon Sep 17 00:00:00 2001 From: Aur Saraf Date: Thu, 15 Feb 2024 15:33:08 +0200 Subject: [PATCH 2/4] Relax version of typing-extensions for V1 (#8819) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dafe3165cb6..cb7632cb6b7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,5 @@ Cython==0.29.32;sys_platform!='win32' devtools==0.9.0 email-validator==2.0.0.post2 dataclasses==0.6; python_version < '3.7' -typing-extensions==4.3.0 +typing-extensions>=4.3.0,<5 python-dotenv==0.20.0 From aa98b58816143d7d265734a56764bf724569bac4 Mon Sep 17 00:00:00 2001 From: Dom Miketa <126485355+exs-dmiketa@users.noreply.github.com> Date: Mon, 25 Mar 2024 21:44:43 +0000 Subject: [PATCH 3/4] Add pydantic.v1 namespace to Pydantic v1 (#9042) Co-authored-by: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> --- pydantic/v1.py | 116 +++++++++++++++++++++++++++++++++++++++++++++++ tests/test_v1.py | 2 + 2 files changed, 118 insertions(+) create mode 100644 pydantic/v1.py create mode 100644 tests/test_v1.py diff --git a/pydantic/v1.py b/pydantic/v1.py new file mode 100644 index 00000000000..7e7895ccd67 --- /dev/null +++ b/pydantic/v1.py @@ -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", +] diff --git a/tests/test_v1.py b/tests/test_v1.py new file mode 100644 index 00000000000..008162e5819 --- /dev/null +++ b/tests/test_v1.py @@ -0,0 +1,2 @@ +def test_imports() -> None: + from pydantic.v1 import BaseModel, dataclasses # noqa: F401 From 5476a758c8ac59887dbfa3aa1c3481d0a0e20837 Mon Sep 17 00:00:00 2001 From: Sydney Runkle <54324534+sydney-runkle@users.noreply.github.com> Date: Wed, 3 Apr 2024 07:38:40 -0500 Subject: [PATCH 4/4] prep for v1.10.15 release (#9157) --- HISTORY.md | 6 ++++++ pydantic/version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 882ee46b0b3..b85b155d007 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,3 +1,9 @@ +## v1.10.15 (2024-04-03) + +* Add pydantic.v1 namespace to Pydantic v1 by @exs-dmiketa in https://github.com/pydantic/pydantic/pull/9042 +* Relax version of typing-extensions for V1 by @SonOfLilit in https://github.com/pydantic/pydantic/pull/8819 +* patch fix for mypy by @sydney-runkle in https://github.com/pydantic/pydantic/pull/8765 + ## v1.10.14 (2024-01-19) * Update install.md by @dmontagu in https://github.com/pydantic/pydantic/pull/7690 diff --git a/pydantic/version.py b/pydantic/version.py index ec982ba7d7c..b1c5547750c 100644 --- a/pydantic/version.py +++ b/pydantic/version.py @@ -1,6 +1,6 @@ __all__ = 'compiled', 'VERSION', 'version_info' -VERSION = '1.10.14' +VERSION = '1.10.15' try: import cython # type: ignore