When setting visibility on a nanobind_extension target, the resulting .so is not visible as requested due to the native.alias indirection. The visibility kwarg needs to be passed to the alias (and also probably the copy_files too):
The alias rule has its own visibility declaration. In all other respects, it behaves like the rule it references (e.g. testonly on the alias is ignored; the testonly-ness of the referenced rule is used instead) with some minor exceptions:
When setting visibility on a
nanobind_extension
target, the resulting .so is not visible as requested due to thenative.alias
indirection. The visibility kwarg needs to be passed to the alias (and also probably thecopy_file
s too):