diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ad6bc..25760ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,11 @@ if(BUILD_PYTHON_BINDINGS) endif() message(STATUS "Zvec install path: ${ZVEC_PY_INSTALL_DIR}") - install(TARGETS _zvec LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR}) + # COMPONENT python: only these runtime artifacts are pulled into the wheel + # (see install.components in pyproject.toml). The cc_library(PACKED) SDK + # install rules use the default component and are excluded from the wheel. + install(TARGETS _zvec LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR} + COMPONENT python) # DiskAnn ships as a runtime-loaded shared module # (libzvec_diskann_plugin.so) that is brought online implicitly the @@ -182,7 +186,8 @@ if(BUILD_PYTHON_BINDINGS) # The target exists only on platforms where DiskAnn is buildable # (currently Linux x86_64 with libaio). if(TARGET core_knn_diskann) - install(TARGETS core_knn_diskann LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR}) + install(TARGETS core_knn_diskann LIBRARY DESTINATION ${ZVEC_PY_INSTALL_DIR} + COMPONENT python) endif() # Bundle cppjieba's dictionary files so the `jieba` FTS tokenizer works # out of the box. python/zvec/__init__.py resolves this directory via @@ -192,5 +197,6 @@ if(BUILD_PYTHON_BINDINGS) install(FILES "${ZVEC_JIEBA_DICT_SRC}/jieba.dict.utf8" "${ZVEC_JIEBA_DICT_SRC}/hmm_model.utf8" - DESTINATION ${ZVEC_PY_INSTALL_DIR}/zvec/data/jieba_dict) + DESTINATION ${ZVEC_PY_INSTALL_DIR}/zvec/data/jieba_dict + COMPONENT python) endif() diff --git a/pyproject.toml b/pyproject.toml index 98fdcff..4f7add5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,6 +102,11 @@ cmake.version = ">=3.26,<4.0" ninja.version = ">=1.11" cmake.build-type = "Release" install.strip = true # Strip symbols in release builds to reduce wheel size +# Only pull the runtime artifacts tagged COMPONENT "python" into the wheel. +# This excludes the C++ SDK install rules (static/shared libs under lib/ and +# public headers under include/) that cc_library(PACKED) registers for a +# standalone `make install`, which would otherwise bloat the wheel. +install.components = ["python"] # Build directory build-dir = "build"