Closed
Description
Describe the issue:
Type checkers (tested with pyright==1.1.356
in strict mode) don't recognize np.bool_
as alias for np.bool
on numpy==2.0.0rc1
.
Unless I'm missing something, this is because bool_
is missing in __init__.pyi
.
Reproduce the code example:
import numpy as np
type NpBool = np.bool_ # results in pyright errors
Error message:
error: Type of "bool_" is unknown (reportUnknownMemberType)
error: "bool_" is not a known member of module "numpy" (reportAttributeAccessIssue)
Python and NumPy Versions:
2.0.0rc1
3.12.2 (main, Feb 25 2024, 16:35:05) [GCC 11.4.0]
Runtime Environment:
No response
Context for the issue:
This makes it impossible to add support for both numpy 1 and 2 in typed python packages, e.g. in https://github.com/jorenham/Lmo/blob/master/lmo/typing.py