Skip to content

Fix python drop#110

Merged
chengcli merged 5 commits intomainfrom
cli/fix_python_drop
Feb 6, 2026
Merged

Fix python drop#110
chengcli merged 5 commits intomainfrom
cli/fix_python_drop

Conversation

@chengcli
Copy link
Owner

@chengcli chengcli commented Feb 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 11:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a Python packaging issue where CUDA libraries were being dropped during linking. The solution wraps CUDA library linker flags with --no-as-needed and --as-needed to prevent the linker from removing them.

Changes:

  • Extracts CUDA libraries from the regular libraries list and adds them to a separate linker flag structure
  • Wraps CUDA library linker flags with --no-as-needed and --as-needed directives (Linux only)
  • Maintains existing rpath configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

setup.py Outdated
Comment on lines 68 to 71
for libname in libraries:
if 'cuda' in libname:
libraries.remove(libname)
cuda_linker.append(f"-l{libname}")
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

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

Modifying a list while iterating over it can cause unexpected behavior and skip elements. When you remove an item from the list, the iterator continues to the next index, but all subsequent items shift down by one position, causing the next item to be skipped. This will result in some CUDA libraries not being properly moved to cuda_linker. Consider using a list comprehension to filter libraries instead, or iterate over a copy of the list.

Suggested change
for libname in libraries:
if 'cuda' in libname:
libraries.remove(libname)
cuda_linker.append(f"-l{libname}")
# Separate CUDA libraries from the rest without mutating the list during iteration
cuda_libs = [lib for lib in libraries if 'cuda' in lib]
libraries = [lib for lib in libraries if 'cuda' not in lib]
for libname in cuda_libs:
cuda_linker.append(f"-l{libname}")

Copilot uses AI. Check for mistakes.
@chengcli chengcli merged commit aa03948 into main Feb 6, 2026
3 checks passed
@chengcli chengcli deleted the cli/fix_python_drop branch February 6, 2026 12:03
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

🎉 Released v1.2.8!

What's Changed

Full Changelog: v1.2.7...v1.2.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant