forked from pool/python-psygnal
Accepting request 1273548 from devel:languages:python
- Add patch support-pydantic-211.patch: * Support Pydantic 2.11 changes by not calling model_fields on instances. OBS-URL: https://build.opensuse.org/request/show/1273548 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-psygnal?expand=0&rev=7
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 30 05:00:03 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-pydantic-211.patch:
|
||||
* Support Pydantic 2.11 changes by not calling model_fields on
|
||||
instances.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 4 16:20:22 UTC 2025 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@@ -23,12 +23,13 @@ Summary: Fast python callback/event system modeled after Qt Signals
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/pyapp-kit/psygnal
|
||||
Source: https://files.pythonhosted.org/packages/source/p/psygnal/psygnal-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM gh#pyapp-kit/psygnal#364
|
||||
Patch0: support-pydantic-211.patch
|
||||
BuildRequires: %{python_module hatch-vcs}
|
||||
BuildRequires: %{python_module hatchling >= 1.8.0}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: python-rpm-macros
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module mypy_extensions}
|
||||
BuildRequires: %{python_module attrs}
|
||||
BuildRequires: %{python_module dask}
|
||||
BuildRequires: %{python_module msgspec}
|
||||
@@ -37,12 +38,9 @@ BuildRequires: %{python_module pydantic}
|
||||
BuildRequires: %{python_module pytest >= 6.0}
|
||||
BuildRequires: %{python_module pytest-cov}
|
||||
BuildRequires: %{python_module toolz}
|
||||
BuildRequires: %{python_module typing-extensions >= 3.7.4.2}
|
||||
BuildRequires: %{python_module wrapt}
|
||||
# /SECTION
|
||||
BuildRequires: fdupes
|
||||
Requires: python-mypy_extensions
|
||||
Requires: python-typing-extensions >= 3.7.4.2
|
||||
Suggests: python-dask
|
||||
Suggests: python-ipython
|
||||
Suggests: python-numpy
|
||||
|
35
support-pydantic-211.patch
Normal file
35
support-pydantic-211.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From e26b74711c598d383112c3450e044d6389fd8be8 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Kowalik <steven@wedontsleep.org>
|
||||
Date: Wed, 30 Apr 2025 14:53:55 +1000
|
||||
Subject: [PATCH] Don't use deprecated model_fields access
|
||||
|
||||
Pydantic 2.11 has deprecated accessing model_fields from instances of
|
||||
the model class, instead requiring callers to use the class itself.
|
||||
|
||||
Fixes #356
|
||||
---
|
||||
src/psygnal/_evented_model.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/psygnal/_evented_model.py b/src/psygnal/_evented_model.py
|
||||
index 31f90f98..c1cf1c57 100644
|
||||
--- a/src/psygnal/_evented_model.py
|
||||
+++ b/src/psygnal/_evented_model.py
|
||||
@@ -111,7 +111,7 @@ def _get_defaults(
|
||||
) -> dict[str, Any]:
|
||||
"""Get possibly nested default values for a Model object."""
|
||||
dflt = {}
|
||||
- for k, v in obj.model_fields.items():
|
||||
+ for k, v in type(obj).model_fields.items():
|
||||
d = v.get_default()
|
||||
if (
|
||||
d is None
|
||||
@@ -547,7 +547,7 @@ def update(self, values: Union["EventedModel", dict], recurse: bool = True) -> N
|
||||
def reset(self) -> None:
|
||||
"""Reset the state of the model to default values."""
|
||||
model_config = _get_config(self)
|
||||
- model_fields = _get_fields(self)
|
||||
+ model_fields = _get_fields(type(self))
|
||||
for name, value in self._defaults.items():
|
||||
if isinstance(value, EventedModel):
|
||||
cast("EventedModel", getattr(self, name)).reset()
|
Reference in New Issue
Block a user