nicholasjng / nanobind-bazel

Bazel defs and rules for building Python projects with nanobind extensions.
Apache License 2.0
8 stars 0 forks source link

Support recursive stub generation #43

Open cemlyn007 opened 2 days ago

cemlyn007 commented 2 days ago

Nanobind supports recursive stub generation but the stubgen wrapper in nanobind-bazel currently cannot use the feature:

INFO: Running command line: bazel-bin/src/foo_ext_stubgen -m _main/src/foo_ext.so -o foo_ext.pyi -M src/py.typed --recursive
usage: python -m nanobind.stubgen [-h] [-o FILE] [-O PATH] [-i PATH] [-m MODULE] [-r] [-M FILE] [-p FILE] [-P] [-D] [-q]
python -m nanobind.stubgen: error: The -o option is not compatible with recursive stub generation (-r).

Supporting this feature would enable developers using Bazel to get type hinting for sub-modules.

nicholasjng commented 1 day ago

Thanks for the report. Would it be enough to just point stubgen to the extension binary with the --recursive flag, or is more work necessary here?

cemlyn007 commented 1 day ago

I'll try to have a go and see if anything breaks but yeah hopefully it'll be a small change!