From f4095052db69d5666d3601b4893661678396b05cd14db0e2e701b5e1f955a8ae Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 16 Nov 2023 10:00:07 +0000 Subject: [PATCH 1/2] - update to 1.10.13: * Fix: Add max length check to `pydantic.validate_email` * Docs: Fix pip commands to install v1 * Fixes the `maxlen` property being dropped on `deque` validation. Happened only if the deque item has been typed. Changes the `_validate_sequence_like` func, #6581 by * Importing create_model in tools.py through relative path instead of absolute path - so that it doesn't import V2 code when copied over to V2 branch, #6361 by @SharathHuddar * Add Pydantic `Json` field support to settings management, * Fixed literal validator errors for unhashable values * Fixed bug with generics receiving forward refs * Update install method of FastAPI for internal tests in CI, #6117 by @Kludex * Use packaging, not pkg_resources for versions. - Skip some truculent tests. * Security fix: Fix date and datetime parsing so passing either 'infinity' * BaseSettings now uses the special env settings to define which * Change the precedence of aliases so child model aliases override * Add support for required Optional with name: Optional[AnyType] = Field(...) * alias precedence logic changed so aliases on a field always take OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=38 --- Fix-Python-3.12-test-failures.patch | 78 +++++++++++++++++++++++++++++ pydantic-1.10.13.tar.gz | 3 ++ pydantic-1.10.9.tar.gz | 3 -- python-pydantic.changes | 32 +++++++++--- python-pydantic.spec | 3 +- 5 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 Fix-Python-3.12-test-failures.patch create mode 100644 pydantic-1.10.13.tar.gz delete mode 100644 pydantic-1.10.9.tar.gz diff --git a/Fix-Python-3.12-test-failures.patch b/Fix-Python-3.12-test-failures.patch new file mode 100644 index 0000000..0a9793a --- /dev/null +++ b/Fix-Python-3.12-test-failures.patch @@ -0,0 +1,78 @@ +From 5fd4002c62d3538efc3ff51f92850f4c0bf4ffab Mon Sep 17 00:00:00 2001 +From: Maxwell G +Date: Sat, 12 Aug 2023 00:21:50 +0000 +Subject: [PATCH] Fix Python 3.12 test failures + +--- + tests/test_abc.py | 15 ++++++++++++--- + tests/test_generics.py | 6 ++++-- + tests/test_types.py | 6 +++++- + 3 files changed, 21 insertions(+), 6 deletions(-) + +diff --git a/tests/test_abc.py b/tests/test_abc.py +index 8beed04..d7e8f3d 100644 +--- a/tests/test_abc.py ++++ b/tests/test_abc.py +@@ -1,4 +1,5 @@ + import abc ++import sys + + import pytest + +@@ -40,7 +41,15 @@ def test_model_subclassing_abstract_base_classes_without_implementation_raises_e + + with pytest.raises(TypeError) as excinfo: + Model(some_field='some_value') +- assert str(excinfo.value) == ( +- "Can't instantiate abstract class Model with abstract methods " +- "my_abstract_classmethod, my_abstract_method, my_abstract_property, my_abstract_staticmethod" # noqa: Q000 ++ message = ( ++ ( ++ "Can't instantiate abstract class Model with abstract methods " ++ "my_abstract_classmethod, my_abstract_method, my_abstract_property, my_abstract_staticmethod" # noqa: Q000 ++ ) ++ if sys.version_info < (3, 12) ++ else ( ++ "Can't instantiate abstract class Model without an implementation for abstract methods " ++ "'my_abstract_classmethod', 'my_abstract_method', 'my_abstract_property', 'my_abstract_staticmethod'" # noqa: Q000 ++ ) + ) ++ assert str(excinfo.value) == message +diff --git a/tests/test_generics.py b/tests/test_generics.py +index 68f93d4..23e6263 100644 +--- a/tests/test_generics.py ++++ b/tests/test_generics.py +@@ -579,9 +579,11 @@ def test_partial_specification_name(): + b: BT + + partial_model = Model[int, BT] +- assert partial_model.__name__ == 'Model[int, BT]' ++ expected = 'Model[int, BT]' if sys.version_info < (3, 12) else 'Model[int, TypeVar]' ++ assert partial_model.__name__ == expected + concrete_model = partial_model[str] +- assert concrete_model.__name__ == 'Model[int, BT][str]' ++ expected += '[str]' ++ assert concrete_model.__name__ == expected + + + def test_partial_specification_instantiation(): +diff --git a/tests/test_types.py b/tests/test_types.py +index b908d46..4277398 100644 +--- a/tests/test_types.py ++++ b/tests/test_types.py +@@ -2713,7 +2713,11 @@ def test_secretfield(): + class Foobar(SecretField): + ... + +- message = "Can't instantiate abstract class Foobar with abstract methods? get_secret_value" ++ message = ( ++ "Can't instantiate abstract class Foobar with abstract methods? get_secret_value" ++ if sys.version_info < (3, 12) ++ else "Can't instantiate abstract class Foobar without an implementation for abstract method 'get_secret_value'" ++ ) + + with pytest.raises(TypeError, match=message): + Foobar() +-- +2.41.0 + diff --git a/pydantic-1.10.13.tar.gz b/pydantic-1.10.13.tar.gz new file mode 100644 index 0000000..83ea960 --- /dev/null +++ b/pydantic-1.10.13.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be1cbc321d34dc1dcca2525f6627a7bbdd879adfe5dbcb43c4ca6d983bd50a42 +size 766572 diff --git a/pydantic-1.10.9.tar.gz b/pydantic-1.10.9.tar.gz deleted file mode 100644 index 0e7cc15..0000000 --- a/pydantic-1.10.9.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:147a6e94420b81d75be7ce63efc64d6cbf8e297ef27d6fc38cd4f542d955687f -size 765868 diff --git a/python-pydantic.changes b/python-pydantic.changes index c7ee17a..7fb2935 100644 --- a/python-pydantic.changes +++ b/python-pydantic.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Thu Nov 16 09:58:50 UTC 2023 - Dirk Müller + +- update to 1.10.13: + * Fix: Add max length check to `pydantic.validate_email` + * Docs: Fix pip commands to install v1 + * Fixes the `maxlen` property being dropped on `deque` + validation. Happened only if the deque item has been typed. + Changes the `_validate_sequence_like` func, #6581 by + * Importing create_model in tools.py through relative path + instead of absolute path - so that it doesn't import V2 code + when copied over to V2 branch, #6361 by @SharathHuddar + * Add Pydantic `Json` field support to settings management, + * Fixed literal validator errors for unhashable values + * Fixed bug with generics receiving forward refs + * Update install method of FastAPI for internal tests in CI, + #6117 by @Kludex + ------------------------------------------------------------------- Wed Jul 5 13:07:17 UTC 2023 - Dirk Müller @@ -168,7 +186,7 @@ Fri Sep 9 00:47:25 UTC 2022 - Steve Kowalik Tue Jul 19 09:20:43 UTC 2022 - Steve Kowalik - Add patch remove-pkg_resources.patch: - * Use packaging, not pkg_resources for versions. + * Use packaging, not pkg_resources for versions. ------------------------------------------------------------------- Sat Jun 18 13:37:28 UTC 2022 - Michael Ströder @@ -200,7 +218,7 @@ Sat Jun 18 13:37:28 UTC 2022 - Michael Ströder ------------------------------------------------------------------- Wed Feb 2 04:12:37 UTC 2022 - Steve Kowalik -- Skip some truculent tests. +- Skip some truculent tests. - Clean up non-required Python 3.6 {Build,}Requires. ------------------------------------------------------------------- @@ -224,7 +242,7 @@ Wed Jan 5 16:08:23 UTC 2022 - Ben Greiner Thu May 13 11:07:30 UTC 2021 - Markéta Machová - Update to 1.8.2 (bsc#1186019, CVE-2021-29510) - * Security fix: Fix date and datetime parsing so passing either 'infinity' + * Security fix: Fix date and datetime parsing so passing either 'infinity' or float('inf') (or their negative values) does not cause an infinite loop * Allow passing json_encoders in class kwargs * support arbitrary types with custom __eq__ @@ -385,19 +403,19 @@ Thu Mar 19 13:25:26 UTC 2020 - Marketa Calabkova * Implement root_validator and rename root errors from __obj__ to __root__ * Added initvars support to post_init_post_parse * complete rewrite of URL parsing logic - * BaseSettings now uses the special env settings to define which + * BaseSettings now uses the special env settings to define which environment variables to read, not aliases * add support for assert statements inside validators - * Change the precedence of aliases so child model aliases override + * Change the precedence of aliases so child model aliases override parent aliases, including using alias_generator * Add a mypy plugin for type checking BaseModel.__init__ and more * Add support for typing.Literal for Python 3.8 * Add a ByteSize type for converting byte string (1GB) to plain bytes - * Add support for required Optional with name: Optional[AnyType] = Field(...) + * Add support for required Optional with name: Optional[AnyType] = Field(...) and refactor ModelField creation to preserve required parameter value * Add __eq__ to SecretStr and SecretBytes to allow "value equals" * Add support for nested generic models - * alias precedence logic changed so aliases on a field always take + * alias precedence logic changed so aliases on a field always take priority over an alias from alias_generator * many more fixes and improvements diff --git a/python-pydantic.spec b/python-pydantic.spec index 0f2ef17..fc6f200 100644 --- a/python-pydantic.spec +++ b/python-pydantic.spec @@ -19,7 +19,7 @@ %{?sle15_python_module_pythons} Name: python-pydantic -Version: 1.10.9 +Version: 1.10.13 Release: 0 Summary: Data validation and settings management using python type hinting License: MIT @@ -28,6 +28,7 @@ Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz# # PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed # (Pulled in by email-validator) Patch0: ignore-urllib3-pyopenssl-warning.patch +Patch1: Fix-Python-3.12-test-failures.patch BuildRequires: %{python_module email-validator >= 1.0.3} BuildRequires: %{python_module packaging} BuildRequires: %{python_module pytest-mock} From 2d2b00865ff8f69c3d52b48be2f375ba6a78293d0ba4da1b8795e1486a4b2e37 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 7 Jan 2024 13:54:22 +0000 Subject: [PATCH 2/2] - add Fix-Python-3.12-test-failures.patch: fix test fails with Python 3.12 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=39 --- python-pydantic.changes | 2 ++ python-pydantic.spec | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/python-pydantic.changes b/python-pydantic.changes index 7fb2935..a9bed6a 100644 --- a/python-pydantic.changes +++ b/python-pydantic.changes @@ -15,6 +15,8 @@ Thu Nov 16 09:58:50 UTC 2023 - Dirk Müller * Fixed bug with generics receiving forward refs * Update install method of FastAPI for internal tests in CI, #6117 by @Kludex +- add Fix-Python-3.12-test-failures.patch: fix test fails with + Python 3.12 ------------------------------------------------------------------- Wed Jul 5 13:07:17 UTC 2023 - Dirk Müller diff --git a/python-pydantic.spec b/python-pydantic.spec index fc6f200..c81b31c 100644 --- a/python-pydantic.spec +++ b/python-pydantic.spec @@ -1,7 +1,7 @@ # # spec file for package python-pydantic # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # Copyright (c) 2019, Martin Hauke # # All modifications and additions to the file contributed by third parties