Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI breaking #1071

Closed
loicdiridollou opened this issue Dec 13, 2024 · 5 comments · Fixed by #1072 or #1078
Closed

CI breaking #1071

loicdiridollou opened this issue Dec 13, 2024 · 5 comments · Fixed by #1072 or #1078

Comments

@loicdiridollou
Copy link
Contributor

Describe the bug
CI is now breaking likely due to some changes in mypy version.

tests/extension/decimal/array.py:83: error: No overload variant of "__setitem__" of "ndarray" matches argument types "int", "Decimal"  [call-overload]
tests/extension/decimal/array.py:83: note: Possible overload variants:
tests/extension/decimal/array.py:83: note:     def __setitem__(self, str | list[str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], /) -> None
tests/extension/decimal/array.py:83: note:     def __setitem__(self, 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, Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], /) -> None
tests/extension/decimal/array.py:86: error: No overload variant of "__setitem__" of "ndarray" matches argument types "int", "Decimal"  [call-overload]
tests/extension/decimal/array.py:86: note: Possible overload variants:
tests/extension/decimal/array.py:86: note:     def __setitem__(self, str | list[str], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], /) -> None
tests/extension/decimal/array.py:86: note:     def __setitem__(self, 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, Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes], /) -> None
tests/test_scalars.py:582: error: Expression is of type "timedelta", not "Timedelta"  [assert-type]
tests/test_scalars.py:641: error: Expression is of type "timedelta", not "Timedelta"  [assert-type]
Found 4 errors in 2 files (checked [22](https://github.com/pandas-dev/pandas-stubs/actions/runs/12307927720/job/34352450935?pr=1070#step:4:23)8 source files)

To Reproduce
Run poetry run poe test_all.

Please complete the following information:

  • OS: [e.g. Windows, Linux, MacOS] All
  • OS Version [e.g. 22] latest
  • python version 3.10 to 3.12
  • version of type checker
  • version of installed pandas-stubs

Additional context
Add any other context about the problem here.

@loicdiridollou
Copy link
Contributor Author

Seems to be linked for the latter two issues with the following changes in numpy:
numpy/numpy@e98a940

@loicdiridollou
Copy link
Contributor Author

loicdiridollou commented Dec 13, 2024

Seems like the type is inferred with the numpy code first and whatever pandas stubs does is ignored (I checked on my side in at runtime the type is a pd.Timedelta and not a timedelta like mypy seems to suggest.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 13, 2024

It is the upgrade from numpy 2.1.3 to numpy 2.2.0

One temporary solution is to change pyproject.toml to have a constraint so that it picks numpy < 2.2.0

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 13, 2024

It's related to microsoft/pyright#4088 . See comments elsewhere in test_scalars.py.

pyright is reporting the same 2 errors with the changes made to numpy. I think we should put a similar comment in there with respect to those tests with appropriate ignore statements

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 13, 2024

Also, the first 2 errors in tests/extension/decimal/array.py are related to a numpy 2.2.0 bug - issue is reported here: numpy/numpy#27964 which is fixed by numpy/numpy#27990

So I think pinning numpy to a version less than 2.2.0 is the way to go for now until a new version is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants