[wx.py.PyShell] read .PYI

Hi, I’m using wx.py.PyShell in an embedded context. I’m wondering if it’s possible to get PyShell to get it’s autocomplete information from the .PYI stub instead of the embedded module?

Practically, the calltips of signatures are generated by the shell.interp.getCallTip. So you can override it and specify the custom interpreter with the InterpClass option of the Shell.
Or, you can monkey-patch to wx.py.introspect.getCallTip where you may have to read .pyi file and parse it using ast module.
But I have doubts about using .pyi file for run-time introspection.

Perhaps the wxpython build process is suggestive for you.
In wxpython build process, as far as I know, core.pyi files are generated first, then core.py, and _core.*.pyd files.
I think the built-in functions and pyi information are combined somewhere by etg, however, Robin’s mechanism is too sophisticated to me that I don’t understand.

1 Like