C++ type names appear in the docstrings
Split off from #261, https://pybind11.readthedocs.io/en/latest/advanced/misc.html#avoiding-cpp-types-in-docstrings
Basically the class declarations need to appear before the methods which involve them. Some can be fixed by init order, such as the Unicode class is only needed/used by the paragraph class, and perhaps the shaper class if it gets more substantial. The rest involves large rearrangements of code, for example canvas has methods involving surface and vice versa, likewise pixmap and image, etc. Some of it will go away as we remove/disable unstable APIs. Probably something to revisit before a non-beta release.
I wrote a script to split the pybind11 class declarations and method definitions (though the implementation is rather stupid). The whole modification process is in the format_code branch. Maybe it can help.
I had a bit of thought on this - ultimately, all declarations need to go before all definitions, so probably it means splitting and putting the declarations into another (header) file which is included by all. Currently we already have common.h for that.