nptyping
is currently useless for static analysis. Quoting a post by the library's developer on its issue tracker,
mypy
is just not supported by nptyping
(yet)
I wouldn't put much hope in that "yet". NumPy's dtype and shape handling is very hard to fit into the typing
/mypy
static type model, and nptyping
's own design decisions are a poor fit for NumPy itself. For example, it doesn't look like the dev ever considered arrays that aren't 2D, so Array[str, 3]
represents a 2D array with 3 rows and unspecified columns instead of a 3-element 1D array. All the implementation is in terms of rows and columns, too.
As far as I can tell, the only real functionality nptyping
has is isinstance
checks, and even that's buggy.
isinstance
gives the expected outputs. Please update your question to include some more information about the error and how you're encountering it