You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For example in my case I don't use numpy, so this by default creates invalid stubs. The _Shape doesn't break any, but I also don't need it. Is this a left over or why does it exist? Thanks
The text was updated successfully, but these errors were encountered:
This is an ad-hoc fix-up for pybind11-style numpy array annotations which are not supported by other tools due to lack of convention. The line from numpy import float64 is not needed if you using recent version of pybind (newer than pybind/pybind11@22b2504) or not binding functions that use numpy at all.
I agree, those lines should be included only when needed.
Also from numpy import float64 imports most common type while strictly speaking it should be checked which types are really needed. I was lazy back then and included it unconditionally because it "anyway it wont hurt" and I needed it most of time.
Note that imports from typing falls into same "not always necessary" category.
Hi! I've updated generated stubs to avoid unnecessary imports. It's still imperfect but apparently more correct than it was before.
It's still unconditionally imports typing, probably that's fine.
Feel free to reopen if you see any troubles with new release.
I noticed the following is always included in the generated stubs.
pybind11-stubgen/pybind11_stubgen/__init__.py
Lines 651 to 654 in 65f01c7
For example in my case I don't use
numpy
, so this by default creates invalid stubs. The_Shape
doesn't break any, but I also don't need it. Is this a left over or why does it exist? ThanksThe text was updated successfully, but these errors were encountered: