nicholasjng / nanobind-bazel

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

Tracking issue for feature-parity with nanobind CMake build system #1

Closed wjakob closed 3 weeks ago

wjakob commented 4 months ago

Dear @nicholasjng,

Thank you for creating a Bazel interface, I think that this will be useful to many people. I took a brief look, and thought to list a few things that are still missing for feature parity:

nicholasjng commented 4 months ago

Thank you for that list!

I'll try and start with the shared lib and stable ABI support. Though I'm wondering if the latter needs something from rules_python first (or is it really just a #define?).

By the way: Why do I still need to dead_strip the resulting shared lib on macOS even if I use the linker response file?

wjakob commented 4 months ago

Yes, those are for different things.

wjakob commented 4 months ago

Stable ABI support requires a #define and a different naming convention for the resulting shared library files (with .abi3.so on linux and an empty suffix on Windows).

wjakob commented 4 months ago

Actually, upon second thought, think that on Windows builds , you might also need to link to a different .lib file. The CMake Development.SABIModule encapsulates this platform-dependent logic.

nicholasjng commented 4 months ago

Good news - I managed to easily build and run the nanobind_example using my local nanobind_bazel repo. I pushed the necessary changes just now, and will update documentation and set up CI shortly.

What's interesting is that in a setuptools build (rules_python does not support E2E wheel buils with C/C++ extensions yet if I understand correctly), current_python_cc_headers grabs the correct headers regardless of which toolchain is configured in the MODULE.bazel, so I get the right headers and libs for multi-Python builds like cibuildwheel out of the box.

nicholasjng commented 4 months ago

Size-optimized builds are now controllable by a feature flag, see #3.

nicholasjng commented 3 months ago

SABI builds for CPython>=3.12 were added in #5.

nicholasjng commented 3 weeks ago

I think all points (outside of PyPy support) are addressed now. I'm going to leave this pinned on the Issue tab and create a followup, but this seems pretty much complete.