- Update to 2.6.3:
* Fix inheriting `Field` annotations in dataclasses * Fix warning for tuple of wrong size in `Union` * Fix `computed_field` JSON serializer `exclude_none` behavior * Check for `email-validator` version >= 2.0 * Add `NatsDsn` * Add `ConfigDict.ser_json_inf_nan` * Support `AliasGenerator` usage * Support `yyyy-MM-DD` datetime parsing * Added bits conversions to the `ByteSize` class * Add `eval_type_backport` to handle union operator * Add support for `dataclass` fields `init` * Implement pickling for `ValidationError` * Add unified tuple validator that can handle "variadic" tuples via PEP-646 * Drop Python3.7 support * Make `@validate_call` return a function instead of a custom descriptor * Introducing `classproperty` decorator for `model_computed_fields` * Move `getattr` warning in deprecated `BaseConfig` * Only hash `model_fields`, not whole `__dict__` * Fix overload position of `computed_field` * Fix issue `unittest.mock` deprecation warnings * Fix `to_snake` conversion * Add support for field `alias` in `dataclass` signature * Fix ordering of keys in `__dict__` with `model_construct` call * Fix usage of `@deprecated` * Add more support for private attributes in `model_construct` call * Support `pydantic.Field(repr=False)` in dataclasses * Override `dataclass_transform` behavior for `RootModel` * Refactor signature generation for simplicity * Fix ordering bug of PlainValidator annotation OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydantic?expand=0&rev=43
This commit is contained in:
parent
57e34151e0
commit
22684d68f4
@ -1,78 +0,0 @@
|
|||||||
From 5fd4002c62d3538efc3ff51f92850f4c0bf4ffab Mon Sep 17 00:00:00 2001
|
|
||||||
From: Maxwell G <maxwell@gtmx.me>
|
|
||||||
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
|
|
||||||
|
|
3
_multibuild
Normal file
3
_multibuild
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<multibuild>
|
||||||
|
<package>test</package>
|
||||||
|
</multibuild>
|
@ -1,12 +0,0 @@
|
|||||||
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
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:c4227c0317989ee9ebb993548e92042066e2b09bbc0618dc67b6cd1972215650
|
|
||||||
size 767164
|
|
3
pydantic-2.6.3.tar.gz
Normal file
3
pydantic-2.6.3.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9719ee749800091e3d81316ca60dea40d17c8be41e68a331d7c0b87b7ce74375
|
||||||
|
size 2710761
|
@ -1,3 +1,135 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Mar 7 03:28:00 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Update to 2.6.3:
|
||||||
|
* Fix inheriting `Field` annotations in dataclasses
|
||||||
|
* Fix warning for tuple of wrong size in `Union`
|
||||||
|
* Fix `computed_field` JSON serializer `exclude_none` behavior
|
||||||
|
* Check for `email-validator` version >= 2.0
|
||||||
|
* Add `NatsDsn`
|
||||||
|
* Add `ConfigDict.ser_json_inf_nan`
|
||||||
|
* Support `AliasGenerator` usage
|
||||||
|
* Support `yyyy-MM-DD` datetime parsing
|
||||||
|
* Added bits conversions to the `ByteSize` class
|
||||||
|
* Add `eval_type_backport` to handle union operator
|
||||||
|
* Add support for `dataclass` fields `init`
|
||||||
|
* Implement pickling for `ValidationError`
|
||||||
|
* Add unified tuple validator that can handle "variadic" tuples via PEP-646
|
||||||
|
* Drop Python3.7 support
|
||||||
|
* Make `@validate_call` return a function instead of a custom descriptor
|
||||||
|
* Introducing `classproperty` decorator for `model_computed_fields`
|
||||||
|
* Move `getattr` warning in deprecated `BaseConfig`
|
||||||
|
* Only hash `model_fields`, not whole `__dict__`
|
||||||
|
* Fix overload position of `computed_field`
|
||||||
|
* Fix issue `unittest.mock` deprecation warnings
|
||||||
|
* Fix `to_snake` conversion
|
||||||
|
* Add support for field `alias` in `dataclass` signature
|
||||||
|
* Fix ordering of keys in `__dict__` with `model_construct` call
|
||||||
|
* Fix usage of `@deprecated`
|
||||||
|
* Add more support for private attributes in `model_construct` call
|
||||||
|
* Support `pydantic.Field(repr=False)` in dataclasses
|
||||||
|
* Override `dataclass_transform` behavior for `RootModel`
|
||||||
|
* Refactor signature generation for simplicity
|
||||||
|
* Fix ordering bug of PlainValidator annotation
|
||||||
|
* Fix `exclude_none` for json serialization of `computed_field`s
|
||||||
|
* Support yyyy-MM-DD string for datetimes
|
||||||
|
* Fix memory leak with recursive definitions creating reference cycles
|
||||||
|
* Add `ConfigDict.ser_json_inf_nan`
|
||||||
|
* Fix validation of `Literal` from JSON keys when used as `dict` key
|
||||||
|
* Fix bug re `custom_init` on members of `Union`
|
||||||
|
* Fix `JsonValue` `bool` serialization
|
||||||
|
* Fix handling of unhashable inputs with `Literal` in `Union`s
|
||||||
|
Fix package description limit
|
||||||
|
* Allow plugins to catch non `ValidationError` errors
|
||||||
|
* Added `validation_error_cause` to config
|
||||||
|
* Allow `str` as argument to `Discriminator`
|
||||||
|
* Add `SchemaSerializer.__reduce__` method to enable pickle serialization
|
||||||
|
* Properly rebuild the `FieldInfo` when a forward ref gets evaluated
|
||||||
|
* Fix failure to load `SecretStr` from JSON (regression in v2.4)
|
||||||
|
* Fix `defer_build` behavior with `TypeAdapter`
|
||||||
|
* Fix: update `TypeVar` handling when default is not set
|
||||||
|
* Raise an error when deleting frozen (model) fields
|
||||||
|
* Use generated alias for aliases that are not specified otherwise
|
||||||
|
* Fix: support `pydantic.Field(kw_only=True)` with inherited dataclasses
|
||||||
|
* Support `validate_call` decorator for methods in classes with `__slots__`
|
||||||
|
* Fix pydantic dataclass problem with `dataclasses.field` default
|
||||||
|
* Support `|` operator (Union) in PydanticRecursiveRef
|
||||||
|
* Add support for `NotRequired` generics in `TypedDict`
|
||||||
|
* Added fix for signature of inherited dataclass
|
||||||
|
* `PrivateAttr` is passed from `Annotated` default position
|
||||||
|
* Don't decode bytes (which may not be UTF8) when displaying SecretBytes
|
||||||
|
* Use `classmethod` instead of `classmethod[Any, Any, Any]`
|
||||||
|
* Clearer error on invalid Plugin
|
||||||
|
* Correct pydantic dataclasses import
|
||||||
|
* Fix `definition-ref` bug with `Dict` keys
|
||||||
|
* Don't accept `NaN` in float and decimal constraints
|
||||||
|
* Add `lax_str` and `lax_int` support for enum values not inherited
|
||||||
|
from str/int
|
||||||
|
* Fix: proper pluralization in `ValidationError` messages
|
||||||
|
* Disallow the string `'-'` as `datetime` input
|
||||||
|
* Fix: NaN and Inf float serialization
|
||||||
|
* Implement optional `number` to `str` coercion
|
||||||
|
* Add `BaseModel.model_validate_strings` and `TypeAdapter.validate_strings`
|
||||||
|
* Add Pydantic `plugins` experimental implementation
|
||||||
|
* Do not override `model_post_init` in subclass with private attrs
|
||||||
|
* Fix config detection for `TypedDict` from grandparent classes
|
||||||
|
* Fix hash function generation for frozen models with unusual MRO
|
||||||
|
* Make `strict` config overridable in field for Path
|
||||||
|
* Use `ser_json_<timedelta|bytes>` on default in `GenerateJsonSchema`
|
||||||
|
* Adding a check that alias is validated as an identifier for Python
|
||||||
|
* Raise an error when computed field overrides field
|
||||||
|
* Enforce behavior of private attributes having double leading underscore
|
||||||
|
* Fix generic dataclass fields mutation bug (when using `TypeAdapter`)
|
||||||
|
* Fix `TypeError` on `model_validator` in `wrap` mode
|
||||||
|
* Fixed a regular expression denial of service issue by limiting whitespaces
|
||||||
|
* Fix handling of `UUID` values having `UUID.version=None`
|
||||||
|
* Fix `__iter__` returning private `cached_property` info
|
||||||
|
* Make ModelWrapValidator protocols generic
|
||||||
|
* Make shadowing attributes a warning instead of an error
|
||||||
|
* Document `Base64Str` and `Base64Bytes`
|
||||||
|
* Fix `config.defer_build` for serialization first cases
|
||||||
|
* Support `__get_validators__`
|
||||||
|
* Replace MiMalloc w/ default allocator
|
||||||
|
* Cleaner error for invalid input to `Path` fields
|
||||||
|
* Add section about Constrained classes to the Migration Guide
|
||||||
|
* Fix issue where generic models couldn't be parametrized with BaseModel
|
||||||
|
* add field_serializer to computed_field
|
||||||
|
* fix dataclass annotated before validator called twice
|
||||||
|
* Add benchmark representing FastAPI startup time
|
||||||
|
* Fix json_encoders for Enum subclasses
|
||||||
|
* Revert "Fix default port for mongosrv DSNs (#6827)"
|
||||||
|
* Do not require `validate_assignment` to use `Field.frozen`
|
||||||
|
* Fix generic computed fields
|
||||||
|
* Handle non-json native enum values
|
||||||
|
* Include Field extra keys name in warning
|
||||||
|
* Skip FieldInfo merging when unnecessary
|
||||||
|
* Add `StringConstraints` for use as Annotated metadata
|
||||||
|
* Fix incorrect subclass check for secretstr
|
||||||
|
* Mypy plugin for settings
|
||||||
|
* fast-path checking finite decimals
|
||||||
|
* Fix pydantic dataclasses that use slots with default values
|
||||||
|
* Fix inheritance of hash function for frozen models
|
||||||
|
* Error if an invalid field name is used with Field
|
||||||
|
* Add `GenericModel` to `MOVED_IN_V2`
|
||||||
|
* remove email validation from the north star benchmark
|
||||||
|
* Fix default port for mongosrv DSNs
|
||||||
|
* Fix serialization issue with `InstanceOf`
|
||||||
|
* Add back support for `json_encoders`
|
||||||
|
* Use `WeakValueDictionary` to fix generic memory leak
|
||||||
|
* Add `config.defer_build` to optionally make model building lazy
|
||||||
|
* Revise the section on required / optional / nullable fields.
|
||||||
|
* Replace TransformSchema with GetPydanticSchema
|
||||||
|
* Fix serialization for IPvAny
|
||||||
|
* Touch up Decimal validator
|
||||||
|
* Handle function validators in a discriminated union
|
||||||
|
* Fix pydantic dataclass problem with dataclasses.field default_factory
|
||||||
|
* Produce more accurate signatures for pydantic dataclasses
|
||||||
|
* Ignore unrecognized fields from dataclasses metadata
|
||||||
|
- Drop patches Fix-Python-3.12-test-failures.patch and
|
||||||
|
ignore-urllib3-pyopenssl-warning.patch
|
||||||
|
- Switch to pyproject macros.
|
||||||
|
- Inject mulitbuild.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jan 22 09:12:28 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
Mon Jan 22 09:12:28 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -17,30 +17,48 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%global flavor @BUILD_FLAVOR@%{nil}
|
||||||
|
%if "%{flavor}" == "test"
|
||||||
|
%define psuffix -test
|
||||||
|
%bcond_without test
|
||||||
|
%else
|
||||||
|
%define psuffix %{nil}
|
||||||
|
%bcond_with test
|
||||||
|
%endif
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-pydantic
|
Name: python-pydantic%{psuffix}
|
||||||
Version: 1.10.14
|
Version: 2.6.3
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Data validation and settings management using python type hinting
|
Summary: Data validation and settings management using python type hinting
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/pydantic/pydantic
|
URL: https://github.com/pydantic/pydantic
|
||||||
Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz#/pydantic-%{version}.tar.gz
|
Source: https://github.com/pydantic/pydantic/archive/v%{version}.tar.gz#/pydantic-%{version}.tar.gz
|
||||||
# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
|
BuildRequires: %{python_module hatch-fancy-pypi-readme}
|
||||||
# (Pulled in by email-validator)
|
BuildRequires: %{python_module hatchling}
|
||||||
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 packaging}
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
|
BuildRequires: fdupes
|
||||||
|
BuildRequires: python-rpm-macros
|
||||||
|
%if %{with test}
|
||||||
|
BuildRequires: %{python_module Faker}
|
||||||
|
BuildRequires: %{python_module cloudpickle}
|
||||||
|
BuildRequires: %{python_module dirty-equals}
|
||||||
|
BuildRequires: %{python_module email-validator >= 2.0}
|
||||||
|
BuildRequires: %{python_module pydantic == %{version}}
|
||||||
|
BuildRequires: %{python_module pytest-benchmark}
|
||||||
|
BuildRequires: %{python_module pytest-examples}
|
||||||
BuildRequires: %{python_module pytest-mock}
|
BuildRequires: %{python_module pytest-mock}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module python-dotenv >= 0.10.4}
|
BuildRequires: %{python_module python-dotenv >= 0.10.4}
|
||||||
BuildRequires: %{python_module setuptools}
|
%endif
|
||||||
BuildRequires: %{python_module typing_extensions >= 4.2.0}
|
Requires: python-annotated-types >= 0.4.0
|
||||||
BuildRequires: fdupes
|
%if 0%{?python_version_nodots} < 310
|
||||||
BuildRequires: python-rpm-macros
|
Requires: python-eval-type-backport
|
||||||
Requires: python-typing_extensions >= 4.2.0
|
%endif
|
||||||
Suggests: python-email-validator >= 1.0.3
|
Requires: python-pydantic-core == 2.16.3
|
||||||
Suggests: python-python-dotenv >= 0.10.4
|
Requires: python-typing_extensions >= 4.6.1
|
||||||
|
Suggests: python-email-validator >= 2.0
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@ -51,21 +69,25 @@ Data validation and settings management using Python type hinting.
|
|||||||
%autosetup -p1 -n pydantic-%{version}
|
%autosetup -p1 -n pydantic-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%if %{without test}
|
||||||
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
%endif
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# Disable DeprecationWarning to avoid error with the latest setuptools
|
%if %{with test}
|
||||||
# and pkg_resources deprecation
|
%pytest
|
||||||
%pytest -k 'not test_multiple_env_file' -W ignore::DeprecationWarning
|
%endif
|
||||||
|
|
||||||
|
%if %{without test}
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc README.md HISTORY.md
|
%doc README.md HISTORY.md
|
||||||
%{python_sitelib}/pydantic
|
%{python_sitelib}/pydantic
|
||||||
%{python_sitelib}/pydantic-%{version}*-info
|
%{python_sitelib}/pydantic-%{version}.dist-info
|
||||||
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user