Replies: 1 comment
-
Yes, I also hit this and fixed it by renaming the produced top-level stub file:
(https://github.com/nurpax/slimgui/blob/main/full_build.sh) I put build steps into a separate shell script so that I can apply workarounds like this. I thought I was doing something wrong when I had to add this but looks like this a bug/limitation in nanobind's stubgen. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The recursive stubgen is great but with one problem, it generates a pyi file named after the top-level module name even if there are submodules. For instance, if I have a module
mylib
and it has a submodulelib
, it will generate two files (1)mylib.pyi
(2)lib/__init__.pyi
. The content ofmylib.pyi
will have the import forlib
:from . import lib as lib
. This only works whenmylib.pyi
is within a package (i.e. is under a directory). I could put these two files under a directory "mylib" to make it a package, but it leads to a new problem, this package does not have__init__.py
, so importingmylib
will not get access to the submodulelib
and any top-level classes/functions. Themylib.pyi
needs to be renamed to__init__.py
.I think stubgen recursive mode should either always generate the top-level module as a package or at least does that when there are submodules.
Beta Was this translation helpful? Give feedback.
All reactions