8000 Fix mypy failures for numpy>=2.3 · Issue #613 · tqec/tqec · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Fix mypy failures for numpy>=2.3 #613
Open
@purva-thakre

Description

@purva-thakre

When the CI installs numpy==2.3, the CI leads to failures for Python 3.11. See #599 (comment) for more.
https://github.com/tqec/tqec/actions/runs/15541135246/job/43751983354#step:8:17

src/tqec/templates/subtemplates.py:287: error: Argument 1 to "tuple" has incompatible type "signedinteger[_32Bit | _64Bit]"; expected "Iterable[Never]"  [arg-type]
src/tqec/templates/subtemplates.py:288: error: Unsupported operand types for - ("frozenset[tuple[Never, ...]]" and "set[tuple[int, ...]]")  [operator]
src/tqec/templates/subtemplates.py:393: error: "signedinteger[_32Bit | _64Bit]" has no attribute "__iter__" (not iterable)  [attr-defined]
src/tqec/templates/subtemplates.py:397: error: Need type annotation for "i"  [var-annotated]
src/tqec/templates/subtemplates.py:397: error: Argument 1 to "enumerate" has incompatible type "signedinteger[_32Bit | _64Bit]"; expected "Iterable[Never]"  [arg-type]
src/tqec/templates/subtemplates.py:405: error: Argument 1 to "tuple" has incompatible type "signedinteger[_32Bit | _64Bit]"; expected "Iterable[int]"  [arg-type]
src/tqec/templates/display.py:51: error: "signedinteger[_32Bit | _64Bit]" has no attribute "__iter__" (not iterable)  [attr-defined]
src/tqec/templates/_testing.py:42: error: No overload variant of "max" matches argument types "signedinteger[_32Bit | _64Bit]", "int"  [call-overload]
src/tqec/templates/_testing.py:42: note: Possible overload variants:
src/tqec/templates/_testing.py:42: note:     def [SupportsRichComparisonT: SupportsDunderLT[Any] | SupportsDunderGT[Any]] max(SupportsRichComparisonT, SupportsRichComparisonT, /, *_args: SupportsRichComparisonT, key: None = ...) -> SupportsRichComparisonT
src/tqec/templates/_testing.py:42: note:     def [_T] max(_T, _T, /, *_args: _T, key: Callable[[_T], SupportsDunderLT[Any] | SupportsDunderGT[Any]]) -> _T
src/tqec/templates/_testing.py:42: note:     def [SupportsRichComparisonT: SupportsDunderLT[Any] | SupportsDunderGT[Any]] max(Iterable[SupportsRichComparisonT], /, *, key: None = ...) -> SupportsRichComparisonT
src/tqec/templates/_testing.py:42: note:     def [_T] max(Iterable[_T], /, *, key: Callable[[_T], SupportsDunderLT[Any] | SupportsDunderGT[Any]]) -> _T
src/tqec/templates/_testing.py:42: note:     def [SupportsRichComparisonT: SupportsDunderLT[Any] | SupportsDunderGT[Any], _T] max(Iterable[SupportsRichComparisonT], /, *, key: None = ..., default: _T) -> SupportsRichComparisonT | _T
src/tqec/templates/_testing.py:42: note:     def [_T1, _T2] max(Iterable[_T1], /, *, key: Callable[[_T1], SupportsDunderLT[Any] | SupportsDunderGT[Any]], default: _T2) -> _T1 | _T2
src/tqec/plaquette/rpng/template.py:22: error: "signedinteger[_32Bit | _64Bit]" has no attribute "__iter__" (not iterable)  [attr-defined]
src/tqec/compile/generation.py:123: error: Invalid index type "signedinteger[_32Bit | _64Bit]" for "Plaquettes"; expected type "int"  [index]
src/tqec/compile/detectors/database.py:97: error: "signedinteger[_32Bit | _64Bit]" has no attribute "__iter__" (not iterable)  [attr-defined]
src/tqec/utils/rotations.py:124: error: Need type annotation for "element"  [var-annotated]
src/tqec/utils/rotations.py:124: error: Argument 1 to "enumerate" has incompatible type "floating[_32Bit]"; expected "Iterable[Never]"  [arg-type]

Note that it is possible these errors fix themselves when a stable version of numpy is released. The release notes for 2.3 state that the documentation is for an unstable developmental version.

Image

https://numpy.org/devdocs/release/2.3.0-notes.html#deprecations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0