Closed GenieTim closed 4 months ago
Stubgen extracts the signatures and annotations from .__doc__
properties. pybind11
not always produces perfectly valid annotations, numpy.ndarray[numpy.float64[m, 1]]
is one of such examples. You can try one of following CLI options to "fix" the stubs:
https://github.com/sizmailov/pybind11-stubgen/blob/7ce3b75a1185326933da90fe31ffb799c6f9d08e/README.md?plain=1#L32-L34
I have a Python library that makes heavy use of the Eigen library. Pybind11 supports that, thankfully, making it easy to bind the C++ code to Python.
Now I am trying to use this library (v2.4.2) for generating stubs.
In principle, this works fine, I am very thankful to you. An exception are the Eigen types: e.g., an
Eigen::VectorXd
, which represents a vector or doubles of indefinite length, is represented with anumpy.ndarray[numpy.float64[m, 1]]
, which results in an error (Can't find/import 'm'
). As I understand, thism
just symbolizes the dynamic nature, i.e., that these vectors (in Python: float arrays) may have any length.I don't understand enough about where this stub generation takes its data from to know whether this is an issue with the stub generation or pybind, but I would be thankful for some guidance.