Skip to content

Question: How to use/validate ndarray[...] types? #34

@tgpfeiffer

Description

@tgpfeiffer

At the moment, the code generated from pybind11-stubgen (0.6.0) has numpy types like

numpy.ndarray[numpy.float64, _Shape[4, 4]]
numpy.ndarray[numpy.int8]
numpy.ndarray[uint8]
numpy.ndarray[float64[3, 1], flags.writeable]

but how do I actually put them to use? I have the numpy-stubs (git+https://github.com/numpy/numpy-stubs.git@c49d2d6875971a669a166ea93ef998911af283a1) installed, but validating the above results in

error: "ndarray" expects no type arguments, but 2 given  [type-arg]

for the ndarray parameters and

error: Bad number of arguments for type alias, expected: 0, given: 2

on the same line (for _Shape I guess?).

At the moment I regex the additional type information away before feeding it to numpy, but how is this actually supposed to be used?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions