CI: Pin numpy
State: closed

Ref: https://github.com/pandas-dev/pandas/pull/42192#issuecomment-866471884

Testing mypy fails with numpy 1.21.0, then will confirm mypy passes with < 1.21

Labels:

Comments:
mypy failed on 9bc997a with the following message:

<details>

```
mypy --version
mypy 0.812
Performing static analysis using mypy
pandas/core/dtypes/cast.py:662: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object_]")  [comparison-overlap]
pandas/core/dtypes/cast.py:1096: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/core/dtypes/cast.py:1107: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/core/dtypes/cast.py:1127: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/core/dtypes/cast.py:1404: error: Incompatible return value type (got "Union[str, Union[dtype[Any], ExtensionDtype]]", expected "Union[dtype[Any], ExtensionDtype]")  [return-value]
pandas/core/dtypes/cast.py:1457: error: Incompatible return value type (got "Union[str, Union[dtype[Any], ExtensionDtype]]", expected "Union[dtype[Any], ExtensionDtype]")  [return-value]
pandas/core/dtypes/cast.py:1834: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/core/dtypes/cast.py:2209: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/core/common.py:422: error: Argument 1 to "RandomState" has incompatible type "Optional[Union[int, Union[ExtensionArray, ndarray[Any, Any]], Generator, RandomState]]"; expected "Union[None, Union[Union[_SupportsArray[dtype[Union[bool_, integer[Any]]]], Sequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]], Sequence[Sequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]]], Sequence[Sequence[Sequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]]]], Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]]]]]], Union[bool, int, Sequence[Union[bool, int]], Sequence[Sequence[Union[bool, int]]], Sequence[Sequence[Sequence[Union[bool, int]]]], Sequence[Sequence[Sequence[Sequence[Union[bool, int]]]]]]], BitGenerator]"  [arg-type]
pandas/core/common.py:426: error: Incompatible return value type (got Module, expected "RandomState")  [return-value]
pandas/core/construction.py:455: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "MaskedArray[Any, Any]")  [assignment]
pandas/core/nanops.py:606: error: Unsupported target for indexed assignment ("Union[ndarray[Any, Any], datetime64, timedelta64]")  [index]
pandas/core/nanops.py:749: error: Argument 3 to "get_empty_reduction_result" has incompatible type "Type[floating[Any]]"; expected "dtype[Any]"  [arg-type]
pandas/core/nanops.py:814: error: unused 'type: ignore' comment
pandas/core/nanops.py:1405: error: unused 'type: ignore' comment
pandas/core/nanops.py:1415: error: unused 'type: ignore' comment
pandas/core/nanops.py:1789: error: unused 'type: ignore' comment
pandas/core/nanops.py:1789: error: Item "type" of "Union[Type[ExtensionArray], Type[ndarray[Any, Any]]]" has no attribute "_simple_new"  [union-attr]
pandas/core/arrays/period.py:344: error: Non-overlapping equality check (left operand type: "Optional[Union[str, dtype[Any]]]", right operand type: "Type[bool]")  [comparison-overlap]
pandas/core/tools/numeric.py:198: error: Incompatible types in assignment (expression has type "Literal['BHILQP']", variable has type "Optional[Literal['bhilqp']]")  [assignment]
pandas/core/tools/numeric.py:200: error: Incompatible types in assignment (expression has type "Literal['efdg']", variable has type "Optional[Literal['bhilqp']]")  [assignment]
pandas/core/tools/numeric.py:206: error: Item "None" of "Optional[Literal['bhilqp']]" has no attribute "index"  [union-attr]
pandas/core/tools/numeric.py:207: error: Value of type "Optional[Literal['bhilqp']]" is not indexable  [index]
pandas/core/tools/numeric.py:207: error: Incompatible types in assignment (expression has type "Union[str, Any]", variable has type "Optional[Literal['bhilqp']]")  [assignment]
pandas/core/tools/numeric.py:212: error: Incompatible types in assignment (expression has type "dtype[Any]", variable has type "str")  [assignment]
pandas/core/tools/numeric.py:213: error: "str" has no attribute "itemsize"  [attr-defined]
pandas/core/tools/numeric.py:214: error: Argument 2 to "maybe_downcast_numeric" has incompatible type "str"; expected "Union[dtype[Any], ExtensionDtype]"  [arg-type]
pandas/core/indexes/base.py:562: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/core/arrays/masked.py:414: error: unused 'type: ignore' comment
pandas/core/arrays/sparse/array.py:1470: error: unused 'type: ignore' comment
pandas/core/apply.py:1083: error: unused 'type: ignore' comment
pandas/core/indexes/extension.py:404: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Literal['M8[ns]']")  [comparison-overlap]
pandas/core/computation/pytables.py:231: error: unused 'type: ignore' comment
pandas/core/indexes/category.py:199: error: unused 'type: ignore' comment
pandas/io/stata.py:856: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:858: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:860: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:862: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:864: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:2036: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:2038: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:2040: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:2042: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:2044: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:2764: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:2766: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[floating[Any]]")  [comparison-overlap]
pandas/io/stata.py:2768: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:2770: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/stata.py:2772: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[signedinteger[Any]]")  [comparison-overlap]
pandas/io/parsers/c_parser_wrapper.py:368: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/io/formats/format.py:1645: error: unused 'type: ignore' comment
pandas/io/formats/format.py:1655: error: unused 'type: ignore' comment
pandas/core/series.py:393: error: unused 'type: ignore' comment
pandas/core/generic.py:9758: error: unused 'type: ignore' comment
pandas/core/generic.py:9758: error: Incompatible return value type (got "ndarray[Any, dtype[Any]]", expected "FrameOrSeries")  [return-value]
pandas/core/frame.py:652: error: Argument 1 to "rec_array_to_mgr" has incompatible type "Union[ndarray[Any, Any], Series, Index]"; expected "Union[MaskedRecords[Any, Any], recarray[Any, Any], ndarray[Any, Any]]"  [arg-type]
pandas/core/frame.py:2284: error: unused 'type: ignore' comment
pandas/core/reshape/reshape.py:1020: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[bool]")  [comparison-overlap]
pandas/core/internals/construction.py:168: error: Argument 1 to "fill_masked_arrays" has incompatible type "MaskedArray[Any, Any]"; expected "MaskedRecords[Any, Any]"  [arg-type]
pandas/core/internals/blocks.py:1899: error: unused 'type: ignore' comment
pandas/core/groupby/ops.py:164: error: Non-overlapping equality check (left operand type: "dtype[Any]", right operand type: "Type[object]")  [comparison-overlap]
pandas/tests/indexing/multiindex/test_indexing_slow.py:24: error: Argument 1 to "map" has incompatible type "Type[Tuple[Any, ...]]"; expected "Callable[[Any], ndarray[Any, Any]]"  [arg-type]
pandas/tests/indexing/multiindex/test_indexing_slow.py:33: error: Argument 1 to "map" has incompatible type "Type[Tuple[Any, ...]]"; expected "Callable[[Any], ndarray[Any, Any]]"  [arg-type]
Found 63 errors in 24 files (checked 1296 source files)
Performing static analysis using mypy DONE
Error: Process completed with exit code 1.
```

</details>
This is just for mypy, not for actual runtime?
@jbrockmendel Right - not sure what the right way forward is. Just confirming it's numpy 1.21.0
is numpy pinned for 3.7? 
@simonjayhawkins is there a way to do this pinning only for the mypy action?
not sure. may have an alternative PR shortly
Closing in favor of #42200