From c5997e0a78713859be412ad1e9d7e3e933b92fc6 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Mon, 17 Jul 2023 16:28:35 +0200 Subject: [PATCH] Delete unused requirements file, simplify nanobind build file (#1635) The dependencies are contained in the `pyproject.toml` since it was added. Switches to header and source file globbing instead of manually listing the files. The selects for different platforms are removed, as a tradeoff, we take a single- to low double-digit hit in wheel sizes (between 5 percent zipped and 12% installed on MacOS 13.4). --- bindings/python/nanobind.BUILD | 62 ++++++-------------------------- bindings/python/requirements.txt | 2 -- 2 files changed, 11 insertions(+), 53 deletions(-) delete mode 100644 bindings/python/requirements.txt diff --git a/bindings/python/nanobind.BUILD b/bindings/python/nanobind.BUILD index 0c00b544..cd9faf99 100644 --- a/bindings/python/nanobind.BUILD +++ b/bindings/python/nanobind.BUILD @@ -1,57 +1,17 @@ - -config_setting( - name = "msvc_compiler", - flag_values = {"@bazel_tools//tools/cpp:compiler": "msvc-cl"}, -) - cc_library( name = "nanobind", - hdrs = glob( - include = [ - "include/nanobind/*.h", - "include/nanobind/stl/*.h", - "include/nanobind/detail/*.h", - ], - exclude = [], - ), - srcs = [ - "include/nanobind/stl/detail/nb_dict.h", - "include/nanobind/stl/detail/nb_list.h", - "include/nanobind/stl/detail/traits.h", - "ext/robin_map/include/tsl/robin_map.h", - "ext/robin_map/include/tsl/robin_hash.h", - "ext/robin_map/include/tsl/robin_growth_policy.h", - "ext/robin_map/include/tsl/robin_set.h", - "src/buffer.h", - "src/common.cpp", - "src/error.cpp", - "src/implicit.cpp", - "src/nb_enum.cpp", - "src/nb_func.cpp", - "src/nb_internals.cpp", - "src/nb_internals.h", - "src/nb_ndarray.cpp", - "src/nb_static_property.cpp", - "src/nb_type.cpp", - "src/trampoline.cpp", - ], - copts = select({ - ":msvc_compiler": [], - "//conditions:default": [ - "-fexceptions", - "-Os", # size optimization - "-flto", # enable LTO - ], - }), - linkopts = select({ - "@com_github_google_benchmark//:macos": [ - "-undefined dynamic_lookup", - "-Wl,-no_fixup_chains", - "-Wl,-dead_strip", - ], - "//conditions:default": [], - }), + srcs = glob([ + "src/*.cpp" + ]), + copts = ["-fexceptions"], includes = ["include", "ext/robin_map/include"], + textual_hdrs = glob( + [ + "include/**/*.h", + "src/*.h", + "ext/robin_map/include/tsl/*.h", + ], + ), deps = ["@python_headers"], visibility = ["//visibility:public"], ) diff --git a/bindings/python/requirements.txt b/bindings/python/requirements.txt deleted file mode 100644 index f5bbe7ec..00000000 --- a/bindings/python/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -absl-py>=0.7.1 -