Summary
Currently a pybind11 .def(...) is emitted for every overridden virtual method. However, pybind11 already exposes a base-class binding to derived Python types (and C++ virtual dispatch routes the call to the right override). That means each of these derived bindings is pure duplication.
In large projects, this can add hundreds and thousands of redundant .def(...)s in wrapper code. The current workaround is to exclude these manually in the yaml config. However, it would complicate the config significantly if there are large numbers of such overrides.
A good fix would be to add an exclude_inherited_overrides option that drops the redundant bindings automatically. This shrinks wrappers package-wide with zero additional per-class config.
Summary
Currently a pybind11
.def(...)is emitted for every overridden virtual method. However, pybind11 already exposes a base-class binding to derived Python types (and C++ virtual dispatch routes the call to the right override). That means each of these derived bindings is pure duplication.In large projects, this can add hundreds and thousands of redundant
.def(...)s in wrapper code. The current workaround is to exclude these manually in the yaml config. However, it would complicate the config significantly if there are large numbers of such overrides.A good fix would be to add an
exclude_inherited_overridesoption that drops the redundant bindings automatically. This shrinks wrappers package-wide with zero additional per-class config.