[Upstream Bug] Please notify NumPy that numpy.typing.ArrayLike
is broken
#176
-
Hi folks When I run this code: from beartype import beartype
import numpy as np
from numpy.typing import ArrayLike
@beartype
def test(a: ArrayLike, b: float) -> ArrayLike:
return a + b
print(test(np.eye(2), 4.0)) I get this:
I'm wondering if it's normal, and if it is, if there are plans to support ArrayLike. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Gah! This is currently afflicting every runtime type-checker – including @braniii: Did you ever get a chance to gently present this bug to NumPy devs? If not, no worries whatsoever. In that case, would you mind doing so instead, @felixchenier? I know, I know. This isn't what anyone wants to do on Wednesday. 😞 |
Beta Was this translation helpful? Give feedback.
-
EDIT: Actually, don't sweat this one, @braniii and @felixchenier. I submitted an upstream NumPy issue tonight calling for clarification. This is a pretty deeply entangling subject. It was probably best that I charge the guns on that one. 🏇 |
Beta Was this translation helpful? Give feedback.
-
I have good news. I have bad news. The bad news is that NumPy devs don't appear to care that their type hinting API is mostly unusable at runtime. The good news is that... okay, I've got nuthin'. There's no good news, actually. @braniii and @felixchenier: would either of you mind chiming in at numpy/numpy#22352? That might help to lend some credibility to this issue and bring a NumPy dev or two around. They're really making it hard for us to love NumPy type hints, aren't they? 😭 |
Beta Was this translation helpful? Give feedback.
-
Thanks a basket of blueberries for all the cheerleading! When NumPy patches in runtime support for this, we'll immediately list Which is great, because you know how I feel about actual work. 😮💨 |
Beta Was this translation helpful? Give feedback.
Thanks a basket of blueberries for all the cheerleading! When NumPy patches in runtime support for this, we'll immediately list
ArrayLike
as officially supported in our Features matrix without having to do any actual work.Which is great, because you know how I feel about actual work. 😮💨