-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: Bazel recursive stubgen example #54
base: bazel
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition! I think this is very valuable to have for nanobind-bazel.
I actually have write access to this repo, since I sometimes need to update the bazel
branch when configurations change (or setuptools breaks again). If @wjakob agrees, I can take over all Bazel-related PRs on this repo.
@@ -0,0 +1 @@ | |||
from ..nanobind_example_ext.sub_ext import sub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that all other submodules reference the top-level nanobind extension, right?
So if I do sm.def_submodule("div_ext", "A submodule for dividing integers");
I need to import from ...nanobind_example_ext.sub_ext.div_ext import div
in src/nanobind_example/sub_ext/div_ext/__init__.py
?
@@ -102,7 +102,10 @@ def bazel_build(self, ext: BazelExtension) -> None: | |||
should_copy = True | |||
|
|||
if should_copy: | |||
shutil.copyfile(root / fp, libdir / fp) | |||
dstdir = libdir / os.path.relpath(root, srcdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think I should just spend some time on a file inclusion function compatible with shutil.copytree()
. Thanks for the fix!
I made this branch mainly for another MR I am trying to merge with the help of @nicholasjng. If/when the nanobind-bazel MR can land, would you maintainers want this example merged as well?
It's meant to be a slight modification of the existing example to create an example sub-module and makes a small modification to the
setup.py
to copy files whilst preserving the module structure.