Replies: 2 comments 7 replies
-
|
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
-
|
@nurpax @wenjuno This is fixed on master now, please let me know if you still encounter issues. The recursive stubgen can now also be directly used from CMake. |
Beta Was this translation helpful? Give feedback.
7 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
myliband it has a submodulelib, it will generate two files (1)mylib.pyi(2)lib/__init__.pyi. The content ofmylib.pyiwill have the import forlib:from . import lib as lib. This only works whenmylib.pyiis 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 importingmylibwill not get access to the submoduleliband any top-level classes/functions. Themylib.pyineeds 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