Skip to content

Commit 0921933

Browse files
Reduce wheel size by excluding source files (#1588)
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 <cursoragent@cursor.com>
1 parent 2928117 commit 0921933

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

cuda_bindings/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33

4-
recursive-include cuda/ *.pyx *.pxd *.pxi
4+
recursive-include cuda/ *.pyx *.pxd *.pxi *.pyx.in *.pxd.in *.pxi.in *.h
55
# at least with setuptools 75.0.0 this folder was added erroneously
66
# to the payload, causing file copying to the build environment failed
77
exclude cuda/bindings cuda?bindings

cuda_bindings/docs/source/release/13.1.2-notes.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
.. SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
.. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
33
44
.. module:: cuda.bindings
@@ -22,6 +22,13 @@ Bugfixes
2222
(`PR #1336 <https://github.com/NVIDIA/cuda-python/pull/1336>`_)
2323
* Fixed ABI incompatibility bugs in cuFILE bindings introduced in v13.1.0.
2424

25+
Miscellaneous
26+
-------------
27+
28+
* Wheel and installed package sizes significantly reduced (e.g., on a typical Linux x86_64
29+
build, wheel from ~16.6 MB to ~5.7 MB and installed from ~152 MB to ~23 MB) by excluding
30+
Cython source files, generated C++ files, and template files from distribution packages.
31+
2532
Known issues
2633
------------
2734

cuda_bindings/pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ Documentation = "https://nvidia.github.io/cuda-python/"
5656
[tool.setuptools.packages.find]
5757
include = ["cuda*"]
5858

59-
[tool.setuptools.exclude-package-data]
60-
"*" = ["*.cpp"]
59+
[tool.setuptools]
60+
include-package-data = false
61+
62+
[tool.setuptools.package-data]
63+
"*" = ["*.pxd", "*.pxi"]
64+
"cuda.bindings._bindings" = ["*.h"]
65+
"cuda.bindings._lib" = ["*.h"]
6166

6267
[tool.setuptools.dynamic]
6368
readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }

cuda_core/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
recursive-include cuda/core *.pyx *.pxd *.pxi
66
recursive-include cuda/core/_cpp *.cpp *.hpp
7+
recursive-include cuda/core/_include *.h *.hpp

cuda_core/docs/source/release/0.6.x-notes.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ None.
3636
Fixes and enhancements
3737
----------------------
3838

39-
None.
39+
- Wheel and installed package sizes significantly reduced (e.g., on a typical Linux x86_64
40+
build, wheel from ~4.6 MB to ~1.6 MB and installed from ~26 MB to ~4.4 MB) by excluding
41+
Cython source files, generated C++ files, and other build artifacts from distribution
42+
packages.

cuda_core/pyproject.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ issues = "https://github.com/NVIDIA/cuda-python/issues/"
7272
[tool.setuptools.packages.find]
7373
include = ["cuda.core*"]
7474

75+
[tool.setuptools]
76+
include-package-data = false
77+
7578
[tool.setuptools.package-data]
76-
"cuda.core._include" = ["*.h", "*.hpp", "*.cuh"]
77-
"cuda.core._cpp" = ["*.cpp", "*.hpp"]
79+
"*" = ["*.pxd"]
80+
"cuda.core._include" = ["*.h", "*.hpp"]
81+
"cuda.core._cpp" = ["*.hpp"]
7882

7983
[tool.setuptools.dynamic]
8084
readme = { file = ["DESCRIPTION.rst"], content-type = "text/x-rst" }

0 commit comments

Comments
 (0)