Skip to content

Exclude Cython-generated .cpp files from wheels#1578

Merged
Andy-Jost merged 1 commit intoNVIDIA:mainfrom
Andy-Jost:fix-cpp-in-wheel
Feb 5, 2026
Merged

Exclude Cython-generated .cpp files from wheels#1578
Andy-Jost merged 1 commit intoNVIDIA:mainfrom
Andy-Jost:fix-cpp-in-wheel

Conversation

@Andy-Jost
Copy link
Contributor

@Andy-Jost Andy-Jost commented Feb 5, 2026

Summary

Cython-generated .cpp files were being included in the wheels, consuming significant space without providing value to users (they have the compiled binaries already).

This PR:

  • Uses cythonize build_dir parameter to place generated .cpp files in build/cython/ instead of the source tree
  • Adds exclude-package-data for *.cpp in cuda-bindings to exclude any remaining .cpp files

Size Reduction

Installed Package Size (uncompressed)

Package Before After Reduction
cuda-bindings 141MB (24 .cpp files) 37MB (0 .cpp files) 74%
cuda-core 28MB (24 .cpp files) 5.4MB (0 .cpp files) 81%
Total 169MB 42.4MB 75%

Wheel Size (compressed)

Package Before After Reduction
cuda-bindings 16MB 7.3MB 54%
cuda-core 17MB 1.7MB 90%
Total 33MB 9MB 73%

Test Plan

  • CI passes
  • Verify wheels do not contain .cpp files
  • Verify packages install and function correctly

Use cythonize build_dir parameter to place generated .cpp files
in build/cython/ instead of the source tree. This prevents them
from being included in the wheel.

Additionally, add exclude-package-data for *.cpp in cuda-bindings
to exclude any remaining .cpp files from the package.
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 5, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Andy-Jost
Copy link
Contributor Author

/ok to test 15cc9f5

@Andy-Jost Andy-Jost requested review from leofang and mdboom and removed request for leofang February 5, 2026 18:51
@Andy-Jost Andy-Jost self-assigned this Feb 5, 2026
@Andy-Jost Andy-Jost requested a review from leofang February 5, 2026 18:51
return cythonize(
extensions,
nthreads=nthreads,
build_dir="build/cython",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required to avoid including the source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this places generated .cpp files outside of the source tree

@Andy-Jost Andy-Jost added the cuda.core Everything related to the cuda.core module label Feb 5, 2026
@Andy-Jost Andy-Jost requested a review from rparolin February 5, 2026 18:52
@Andy-Jost Andy-Jost added cuda.bindings Everything related to the cuda.bindings module enhancement Any code-related improvements labels Feb 5, 2026
@Andy-Jost Andy-Jost requested a review from rwgk February 5, 2026 18:52
@Andy-Jost
Copy link
Contributor Author

/ok to test 15cc9f5

@github-actions

This comment has been minimized.

@Andy-Jost Andy-Jost enabled auto-merge (squash) February 5, 2026 19:12
@Andy-Jost Andy-Jost merged commit eec6988 into NVIDIA:main Feb 5, 2026
173 of 175 checks passed
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Doc Preview CI
Preview removed because the pull request was closed or merged.

@Andy-Jost Andy-Jost deleted the fix-cpp-in-wheel branch February 5, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module cuda.core Everything related to the cuda.core module enhancement Any code-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants