On using pybind11_stubgen
-defined classes in generated stubs
#200
Labels
bug
Something isn't working
pybind11_stubgen
-defined classes in generated stubs
#200
Is there a specific philosophy that this repo has about using
pybind11_stubgen
-defined classes in the generated stubs?At the moment, I see that this is done mainly for
--numpy-array-wrap-with-annotated
withpybind11_stubgen.typing_ext.FixedSize
andpybind11_stubgen.typing_ext.DynamicSize("m", "n")
, although I am also seeing it in #199.My main concern with not making this choice explicit is that a lot of projects incorporating
pybind11_stubgen
into their builds might only includepybind11_stubgen
as a build dependency and not as a required dependency of the whole project. This would mean users installing these projects would not havepybind11_stubgen
installed, and type checkers would fail to resolve these expressions, in part or in full.There are a few non-mutually exclusive options that I can think of:
pybind11_stubgen
-defined classes at all in generated stubs. I think this is the safest default approach.pybind11_stubgen
-defined classes into the generated stubs. Maybe asProtocol
s? Would this mean re-defining aFixedSize
protocol in every file it is used in?pybind11_stubgen
, with the user explicitly acknowledging that they must markpybind11_stubgen
as a required dependency of their project in order to fully utilize the generated stubs.The text was updated successfully, but these errors were encountered: