You can use the nptyping package, which offers type hints specifically for Numpy data types.
Unless you want to create a custom Numpy container, the best you can do is to denote your array as a container of typing.Any
objects, since support for types beyond the ones mentioned here is lacking.
from nptyping import NDArray, Shape
from typing import Any
import numpy as np
class Item:
pass
class Foo:
def __init__(self, bar: NDArray[Shape["1,2"], Any]):
self.bar = bar
if __name__ == '__main__':
item = Item()
foo = Foo(bar=np.array([Item(), Item()], dtype=Item))
print(foo.bar)
Running this will yield something like
[<__main__.Item object at 0x7f13f0dd9e80>
<__main__.Item object at 0x7f13f0dd9040>]