From 4b1c6e633132f804a53af31c9630bb24d357769d348cac7ce25d54b0a4a3c9df Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 9 Sep 2022 00:58:49 +0000 Subject: [PATCH] - Update to 1.10.2: * Prevent long (length > 4_300) strings/bytes as input to int fields, see python/cpython#95778 and CVE-2020-10735 * fix: dataclass wrapper was not always called * Use tomllib on Python 3.11 when parsing mypy configuration * Basic fix of GenericModel cache to detect order of arguments in Union models * Fix mypy plugin when using bare types like list and dict as default_factory * Add __hash__ method to pydancic.color.Color class * Refactor the whole pydantic dataclass decorator to really act like its standard lib equivalent. It hence keeps __eq__, __hash__, ... and makes comparison with its non-validated version possible. * Now that Config.extra is supported, dataclass ignores by default extra arguments (like BaseModel) * Fix PEP487 __set_name__ protocol in BaseModel for PrivateAttrs * Allow for custom parsing of environment variables via parse_env_var in Config * Fix StrictStr does not raise ValidationError when max_length is present in Field * Make SecretStr and SecretBytes hashable * Fix StrictBytes does not raise ValidationError when max_length is present in Field * Add support for bare type * Support Python 3.11, including binaries for 3.11 in PyPI * Add support for re.Pattern * Fix __post_init_post_parse__ is incorrectly passed keyword arguments when no __post_init__ is defined * Fix implicitly importing ForwardRef and Callable from pydantic.typing instead of typing and also expose MappingIntStrAny * remove Any types from the dataclass decorator so it can be used with the disallow_any_expr mypy option OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=26 --- ignore-urllib3-pyopenssl-warning.patch | 12 ++++ pydantic-1.10.2.tar.gz | 3 + pydantic-1.9.1.tar.gz | 3 - python-pydantic.changes | 78 ++++++++++++++++++++++++++ python-pydantic.spec | 16 +++--- remove-pkg_resources.patch | 22 -------- 6 files changed, 102 insertions(+), 32 deletions(-) create mode 100644 ignore-urllib3-pyopenssl-warning.patch create mode 100644 pydantic-1.10.2.tar.gz delete mode 100644 pydantic-1.9.1.tar.gz delete mode 100644 remove-pkg_resources.patch diff --git a/ignore-urllib3-pyopenssl-warning.patch b/ignore-urllib3-pyopenssl-warning.patch new file mode 100644 index 0000000..02899b9 --- /dev/null +++ b/ignore-urllib3-pyopenssl-warning.patch @@ -0,0 +1,12 @@ +Index: pydantic-1.10.2/setup.cfg +=================================================================== +--- pydantic-1.10.2.orig/setup.cfg ++++ pydantic-1.10.2/setup.cfg +@@ -11,6 +11,7 @@ filterwarnings = + # for Python 3.11 + ignore:path is deprecated.*:DeprecationWarning:certifi + ignore:module 'sre_constants' is deprecated:DeprecationWarning:pkg_resources ++ ignore:.*urllib3.contrib.pyopenssl.*:DeprecationWarning + + [flake8] + max-line-length = 120 diff --git a/pydantic-1.10.2.tar.gz b/pydantic-1.10.2.tar.gz new file mode 100644 index 0000000..47771fd --- /dev/null +++ b/pydantic-1.10.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27c4e87d71b7d7858ef7c466ffdaad6ff7055e208c5c3267fabf29ef49e5dbef +size 888288 diff --git a/pydantic-1.9.1.tar.gz b/pydantic-1.9.1.tar.gz deleted file mode 100644 index 09e1a16..0000000 --- a/pydantic-1.9.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4eddd11262bc0d708ba0ffb88565cc624f34e43b2388cfa61c5d1a0ed154628c -size 677708 diff --git a/python-pydantic.changes b/python-pydantic.changes index d1a2e9b..6dde85d 100644 --- a/python-pydantic.changes +++ b/python-pydantic.changes @@ -1,3 +1,81 @@ +------------------------------------------------------------------- +Fri Sep 9 00:47:25 UTC 2022 - Steve Kowalik + +- Update to 1.10.2: + * Prevent long (length > 4_300) strings/bytes as input to int fields, see + python/cpython#95778 and CVE-2020-10735 + * fix: dataclass wrapper was not always called + * Use tomllib on Python 3.11 when parsing mypy configuration + * Basic fix of GenericModel cache to detect order of arguments in Union models + * Fix mypy plugin when using bare types like list and dict as default_factory + * Add __hash__ method to pydancic.color.Color class + * Refactor the whole pydantic dataclass decorator to really act like its + standard lib equivalent. It hence keeps __eq__, __hash__, ... and makes + comparison with its non-validated version possible. + * Now that Config.extra is supported, dataclass ignores by default extra + arguments (like BaseModel) + * Fix PEP487 __set_name__ protocol in BaseModel for PrivateAttrs + * Allow for custom parsing of environment variables via parse_env_var in + Config + * Fix StrictStr does not raise ValidationError when max_length is present + in Field + * Make SecretStr and SecretBytes hashable + * Fix StrictBytes does not raise ValidationError when max_length is present + in Field + * Add support for bare type + * Support Python 3.11, including binaries for 3.11 in PyPI + * Add support for re.Pattern + * Fix __post_init_post_parse__ is incorrectly passed keyword arguments when + no __post_init__ is defined + * Fix implicitly importing ForwardRef and Callable from pydantic.typing + instead of typing and also expose MappingIntStrAny + * remove Any types from the dataclass decorator so it can be used with the + disallow_any_expr mypy option + * fix "extra fields not permitted" error when dataclass with Extra.forbid + is validated multiple times + * Discriminated union models now use oneOf instead of anyOf when generating + OpenAPI schema definitions + * Allow type checkers to infer inner type of Json type. Json[list[str]] will + be now inferred as list[str] + * Allow empty string aliases by using a alias is not None check, rather + than bool(alias) + * Use parent model's Config when validating nested NamedTuple fields + * Update BaseModel.construct to work with aliased Fields + * Catch certain raised errors in smart_deepcopy and revert to deepcopy if so + * Add Config.anystr_upper and to_upper kwarg to constr and conbytes + * Fix JSON schema for set and frozenset when they include default values + * Teach the mypy plugin that methods decorated by @validator are classmethods + * Improve mypy plugin's ability to detect required fields + * Support fields of type Type[] in schema + * Adds reserved word check to signature generation logic + * Fix Json strategy failure for the complex nested field + * Add JSON-compatible float constraint allow_inf_nan + * Remove undefined behaviour when env_prefix had characters in common with + env_nested_delimiter + * Support generics model with create_model + * allow submodels to overwrite extra field info + * support overwriting dunder attributes of BaseModel instances + * Support kw_only in dataclasses + * Add comparison method for Color class + * created new function to_lower_camel() for "non pascal case" camel case + * Add checks to default and default_factory arguments in Mypy plugin + * Fix parsing of very small numeric timedelta values + * Update SecretsSettingsSource to respect config.case_sensitive + * Add support for multiple dotenv files + * Raise an explicit ConfigError when multiple fields are incorrectly set + for a single validator + * Allow ellipsis on Fields inside Annotated for TypedDicts required + * Catch overflow errors in int_validator + * validate_arguments decorator now supports alias + * Add ability to use Final in a field type annotation + * Update requirement to typing_extensions>=4.1.0 to guarantee + dataclass_transform is available +- Remove patch remove-pkg_resources.patch: + * Included upstream. +- Add patch ignore-urllib3-pyopenssl-warning.patch: + * Ignore DeprecationWarning until requests-toolbelt is fixed. +- Update {Build,}Requires to email-validator package. + ------------------------------------------------------------------- Tue Jul 19 09:20:43 UTC 2022 - Steve Kowalik diff --git a/python-pydantic.spec b/python-pydantic.spec index b414511..cf19527 100644 --- a/python-pydantic.spec +++ b/python-pydantic.spec @@ -20,24 +20,26 @@ %{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 Name: python-pydantic -Version: 1.9.1 +Version: 1.10.2 Release: 0 Summary: Data validation and settings management using python type hinting License: MIT URL: https://github.com/samuelcolvin/pydantic Source: https://github.com/samuelcolvin/pydantic/archive/v%{version}.tar.gz#/pydantic-%{version}.tar.gz -Patch0: remove-pkg_resources.patch -BuildRequires: %{python_module email_validator >= 1.0.3} +# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed +# (Pulled in by email-validator) +Patch0: ignore-urllib3-pyopenssl-warning.patch +BuildRequires: %{python_module email-validator >= 1.0.3} BuildRequires: %{python_module packaging} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest} BuildRequires: %{python_module python-dotenv >= 0.10.4} BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module typing_extensions >= 3.7.4.3} +BuildRequires: %{python_module typing_extensions >= 4.1.0} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-typing_extensions >= 3.7.4.3 -Suggests: python-email_validator >= 1.0.3 +Requires: python-typing_extensions >= 4.1.0 +Suggests: python-email-validator >= 1.0.3 Suggests: python-python-dotenv >= 0.10.4 BuildArch: noarch %python_subpackages @@ -56,7 +58,7 @@ Data validation and settings management using Python type hinting. %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%pytest -k 'not test_is_none_type and not test_none' +%pytest -k 'not test_multiple_env_file' %files %{python_files} %license LICENSE diff --git a/remove-pkg_resources.patch b/remove-pkg_resources.patch deleted file mode 100644 index 27404c2..0000000 --- a/remove-pkg_resources.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: pydantic-1.9.1/tests/test_utils.py -=================================================================== ---- pydantic-1.9.1.orig/tests/test_utils.py -+++ pydantic-1.9.1/tests/test_utils.py -@@ -8,7 +8,7 @@ from copy import copy, deepcopy - from typing import Callable, Dict, List, NewType, Tuple, TypeVar, Union - - import pytest --from pkg_resources import safe_version -+from packaging.version import Version - from typing_extensions import Annotated, Literal - - from pydantic import VERSION, BaseModel, ConstrainedList, conlist -@@ -379,7 +379,7 @@ def test_version_info(): - - - def test_standard_version(): -- assert safe_version(VERSION) == VERSION -+ assert str(Version(VERSION)) == VERSION - - - def test_class_attribute():