From 8863ef83825fe87b7074ab79e539272ba0d929dd Mon Sep 17 00:00:00 2001
From: Rene Luria <rene.luria@infomaniak.com>
Date: Mon, 8 Dec 2025 13:16:52 +0100
Subject: [PATCH] fix python3.14

---
 debian/patches/python3.14-compatibility.patch | 94 +++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 debian/patches/python3.14-compatibility.patch

diff --git a/debian/patches/python3.14-compatibility.patch b/debian/patches/python3.14-compatibility.patch
new file mode 100644
index 0000000..5043e0d
--- /dev/null
+++ b/debian/patches/python3.14-compatibility.patch
@@ -0,0 +1,94 @@
+Description: Fix Python 3.14 compatibility by removing __doc__ assignments to type aliases
+ Python 3.14 made typing.Union and TypeVar objects' __doc__ attributes read-only,
+ preventing assignment of custom documentation strings. This patch removes all
+ __doc__ assignments from type aliases to make pyvista importable in Python 3.14.
+ .
+ This is based on upstream PR #8102:
+ https://github.com/pyvista/pyvista/pull/8102
+Author: Rene Luria <rene.luria@infomaniak.com>
+Bug-Debian: https://bugs.debian.org/1122096
+Forwarded: not-needed
+Last-Update: 2025-12-08
+
+--- a/pyvista/core/_typing_core/_aliases.py
++++ b/pyvista/core/_typing_core/_aliases.py
+@@ -37,28 +37,14 @@ from ._array_like import _ArrayLike2D
+ Number = Union[int, float]
+
+ VectorLike = _ArrayLike1D[NumberType]
+-VectorLike.__doc__ = """One-dimensional array-like object with numerical values.
+-
+-Includes sequences and numpy arrays.
+-"""
+
+ MatrixLike = _ArrayLike2D[NumberType]
+-MatrixLike.__doc__ = """Two-dimensional array-like object with numerical values.
+-
+-Includes singly-nested sequences and numpy arrays.
+-"""
+
+ ArrayLike = _ArrayLike[NumberType]
+-ArrayLike.__doc__ = """Any-dimensional array-like object with numerical values.
+-
+-Includes sequences, nested sequences, and numpy arrays. Scalar values are not included.
+-"""
+ if Rotation is not None:
+     RotationLike = Union[MatrixLike[float], _vtk.vtkMatrix3x3, Rotation]
+ else:
+     RotationLike = Union[MatrixLike[float], _vtk.vtkMatrix3x3]  # type: ignore[misc]
+-RotationLike.__doc__ = """Array or object representing a spatial rotation.
+-
+-Includes 3x3 arrays and SciPy Rotation objects.
+-"""
+
+ TransformLike = Union[RotationLike, _vtk.vtkMatrix4x4, _vtk.vtkTransform]
+-TransformLike.__doc__ = """Array or object representing a spatial transformation.
+-
+-Includes 3x3 and 4x4 arrays as well as SciPy Rotation objects."""
+
+
+@@ -119,6 +105,3 @@ CellArrayLike = Union[CellsLike, _vtk.vtkCellArray]
+ _ArrayLikeOrScalar = Union[NumberType, ArrayLike[NumberType]]
+
+ InteractionEventType = Union[Literal['end', 'start', 'always'], _vtk.vtkCommand.EventIds]
+-InteractionEventType.__doc__ = """Interaction event mostly used for widgets.
+-
+-Includes both strings such as `end`, 'start' and `always` and `_vtk.vtkCommand.EventIds`.
+-"""
+--- a/pyvista/core/_typing_core/_array_like.py
++++ b/pyvista/core/_typing_core/_array_like.py
+@@ -35,7 +35,6 @@ NumberType = TypeVar(
+     'NumberType',
+     bound=Union[np.floating, np.integer, np.bool_, float, int, bool],
+ )
+-NumberType.__doc__ = """Type variable for numeric data types."""
+
+ # Create a copy of the typevar which can be used for annotating a second variable.
+ # Its definition should be identical to `NumberType`
+--- a/pyvista/core/_typing_core/_dataset_types.py
++++ b/pyvista/core/_typing_core/_dataset_types.py
+@@ -15,23 +15,14 @@ from pyvista.core.pointset import PolyData
+ from pyvista.core.pointset import UnstructuredGrid
+ from pyvista.core.pointset import _PointSet
+
+ _GridType = TypeVar('_GridType', bound=Grid)
+-_GridType.__doc__ = """Type variable for PyVista ``Grid`` classes."""
+
+ _PointGridType = TypeVar('_PointGridType', bound=PointGrid)
+-_PointGridType.__doc__ = """Type variable for PyVista ``PointGrid`` classes."""
+
+ _PointSetType = TypeVar('_PointSetType', bound=_PointSet)
+-_PointSetType.__doc__ = """Type variable for PyVista ``PointSet`` classes."""
+
+ _DataSetType = TypeVar('_DataSetType', bound=DataSet)
+-_DataSetType.__doc__ = """Type variable for :class:`~pyvista.DataSet` classes."""
+
+ _DataSetOrMultiBlockType = TypeVar('_DataSetOrMultiBlockType', bound=Union[DataSet, MultiBlock])
+-_DataSetOrMultiBlockType.__doc__ = (
+-    """Type variable for :class:`~pyvista.DataSet` or :class:`~pyvista.MultiBlock` classes."""
+-)
+
+ _DataObjectType = TypeVar('_DataObjectType', bound=DataObject)
+-_DataObjectType.__doc__ = """Type variable for :class:`~pyvista.DataObject` classes."""
+
+
-- 
2.47.0

