From f514b8e2bffa890ef4f00463a548d476ff87bf5a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:20:13 -0500 Subject: [PATCH] Pin numpy<2.2 in lint workflow (backport #722) (#723) * Pin numpy<2.2 in lint workflow (#722) Somehow, with numpy 2.2, the mypy fails with the following error: ``` qiskit_addon_cutting/cut_finding/circuit_interface.py:318: error: No overload variant of "__getitem__" of "Sequence" matches argument type "signedinteger[_32Bit | _64Bit]" [call-overload] qiskit_addon_cutting/cut_finding/circuit_interface.py:318: note: Possible overload variants: qiskit_addon_cutting/cut_finding/circuit_interface.py:318: note: def __getitem__(self, int, /) -> int | tuple[str, int] qiskit_addon_cutting/cut_finding/circuit_interface.py:318: note: def __getitem__(self, slice, /) -> Sequence[int | tuple[str, int]] qiskit_addon_cutting/cut_finding/disjoint_subcircuits_state.py:330: error: Invalid index type "Hashable" for "ndarray[tuple[int, ...], dtype[signedinteger[_32Bit | _64Bit]]]"; expected type "SupportsIndex | slice | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool]] | dtype[integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]] | dtype[integer[Any]]]] | builtins.bool | int | _NestedSequence[builtins.bool | int] | tuple[SupportsIndex | slice | EllipsisType | _SupportsArray[dtype[numpy.bool[builtins.bool]] | dtype[integer[Any]]] | _NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool]] | dtype[integer[Any]]]] | builtins.bool | int | _NestedSequence[builtins.bool | int] | None, ...] | None" [index] ``` Hence we pin numpy as a workaround. (cherry picked from commit d44ca0a0ebf61acebe5d67185545c1aad33fa314) # Conflicts: # pyproject.toml * resolve conflict --------- Co-authored-by: Jim Garrison --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4f972b1a..1e518a5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ lint = [ "mypy==1.11.2", "reno>=3.4.0", "pylint==3.2.7", + "numpy<2.2", ] docs = [ "Sphinx>=3.0.0",