From 02966e4af879006118a7d0b12dd26f30ed7b830b Mon Sep 17 00:00:00 2001 From: Andy Jost Date: Fri, 6 Feb 2026 16:01:54 -0800 Subject: [PATCH] Reduce wheel size by excluding source files Use opt-in package-data approach to control what goes into wheels: - Set include-package-data = false to prevent MANIFEST.in auto-inclusion - Explicitly include only .pxd files (for downstream cimport) and headers cuda_core wheel size reduced from ~5 MB to ~1.6 MB (68% reduction). Also fix MANIFEST.in for both packages to include all files needed for sdist builds (headers, template files). Co-authored-by: Cursor --- cuda_bindings/MANIFEST.in | 2 +- .../docs/source/release/13.1.2-notes.rst | 9 ++++- cuda_bindings/pyproject.toml | 9 ++++- cuda_core/MANIFEST.in | 1 + cuda_core/docs/source/release/0.6.x-notes.rst | 40 +++++++++++++++++++ cuda_core/pyproject.toml | 8 +++- 6 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 cuda_core/docs/source/release/0.6.x-notes.rst diff --git a/cuda_bindings/MANIFEST.in b/cuda_bindings/MANIFEST.in index a98aa53f22..39073c42fd 100644 --- a/cuda_bindings/MANIFEST.in +++ b/cuda_bindings/MANIFEST.in @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE -recursive-include cuda/ *.pyx *.pxd *.pxi +recursive-include cuda/ *.pyx *.pxd *.pxi *.pyx.in *.pxd.in *.pxi.in *.h # at least with setuptools 75.0.0 this folder was added erroneously # to the payload, causing file copying to the build environment failed exclude cuda/bindings cuda?bindings diff --git a/cuda_bindings/docs/source/release/13.1.2-notes.rst b/cuda_bindings/docs/source/release/13.1.2-notes.rst index a7f8fbb773..aaeb71db73 100644 --- a/cuda_bindings/docs/source/release/13.1.2-notes.rst +++ b/cuda_bindings/docs/source/release/13.1.2-notes.rst @@ -1,4 +1,4 @@ -.. SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. .. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE .. module:: cuda.bindings @@ -22,6 +22,13 @@ Bugfixes (`PR #1336 `_) * Fixed ABI incompatibility bugs in cuFILE bindings introduced in v13.1.0. +Miscellaneous +------------- + +* Wheel and installed package sizes significantly reduced (e.g., on a typical Linux x86_64 + build, wheel from ~16.6 MB to ~5.7 MB and installed from ~152 MB to ~23 MB) by excluding + Cython source files, generated C++ files, and template files from distribution packages. + Known issues ------------ diff --git a/cuda_bindings/pyproject.toml b/cuda_bindings/pyproject.toml index f851af87c9..40ced6850c 100644 --- a/cuda_bindings/pyproject.toml +++ b/cuda_bindings/pyproject.toml @@ -56,8 +56,13 @@ Documentation = "https://nvidia.github.io/cuda-python/" [tool.setuptools.packages.find] include = ["cuda*"] -[tool.setuptools.exclude-package-data] -"*" = ["*.cpp"] +[tool.setuptools] +include-package-data = false + +[tool.setuptools.package-data] +"*" = ["*.pxd", "*.pxi"] +"cuda.bindings._bindings" = ["*.h"] +"cuda.bindings._lib" = ["*.h"] [tool.setuptools.dynamic] readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" } diff --git a/cuda_core/MANIFEST.in b/cuda_core/MANIFEST.in index 26a21144f7..f476ae8ef2 100644 --- a/cuda_core/MANIFEST.in +++ b/cuda_core/MANIFEST.in @@ -4,3 +4,4 @@ recursive-include cuda/core *.pyx *.pxd *.pxi recursive-include cuda/core/_cpp *.cpp *.hpp +recursive-include cuda/core/_include *.h *.hpp diff --git a/cuda_core/docs/source/release/0.6.x-notes.rst b/cuda_core/docs/source/release/0.6.x-notes.rst new file mode 100644 index 0000000000..d1de1114e1 --- /dev/null +++ b/cuda_core/docs/source/release/0.6.x-notes.rst @@ -0,0 +1,40 @@ +.. SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +.. SPDX-License-Identifier: Apache-2.0 + +.. currentmodule:: cuda.core + +``cuda.core`` 0.6.x Release Notes +================================= + + +Highlights +---------- + +None. + + +Breaking Changes +---------------- + +None. + + +New features +------------ + +None. + + +New examples +------------ + +None. + + +Fixes and enhancements +---------------------- + +- Wheel and installed package sizes significantly reduced (e.g., on a typical Linux x86_64 + build, wheel from ~4.6 MB to ~1.6 MB and installed from ~26 MB to ~4.4 MB) by excluding + Cython source files, generated C++ files, and other build artifacts from distribution + packages. diff --git a/cuda_core/pyproject.toml b/cuda_core/pyproject.toml index 1c295b04ce..2078187a63 100644 --- a/cuda_core/pyproject.toml +++ b/cuda_core/pyproject.toml @@ -72,9 +72,13 @@ issues = "https://github.com/NVIDIA/cuda-python/issues/" [tool.setuptools.packages.find] include = ["cuda.core*"] +[tool.setuptools] +include-package-data = false + [tool.setuptools.package-data] -"cuda.core._include" = ["*.h", "*.hpp", "*.cuh"] -"cuda.core._cpp" = ["*.cpp", "*.hpp"] +"*" = ["*.pxd"] +"cuda.core._include" = ["*.h", "*.hpp"] +"cuda.core._cpp" = ["*.hpp"] [tool.setuptools.dynamic] readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }