Skip to content

Conversation

@LoserCheems
Copy link
Collaborator

Introduce functionality to generate URLs for pre-built wheels and implement caching to avoid unnecessary builds. This enhancement allows for efficient retrieval of compatible wheels based on environment parameters.

Copilot AI review requested due to automatic review settings September 8, 2025 07:34
@LoserCheems LoserCheems merged commit c4b6046 into main Sep 8, 2025
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 introduces functionality to efficiently handle pre-built wheels by adding URL generation and caching capabilities to the setup process. Instead of always building from source, the system can now attempt to download compatible pre-built wheels based on environment parameters before falling back to compilation.

  • Adds URL generation for pre-built wheels based on CUDA version, Python version, and platform
  • Implements a custom CachedWheelsCommand that attempts to download compatible wheels before building
  • Updates the setup configuration to use the new caching command

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +354 to +355
try:
urllib.request.urlretrieve(wheel_url, wheel_filename)
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Using urllib.request.urlretrieve without SSL verification or timeout could pose security risks. Consider adding timeout parameter and validating the downloaded file integrity with checksums.

Copilot uses AI. Check for mistakes.
wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
print("Raw wheel path", wheel_path)
os.rename(wheel_filename, wheel_path)
except (urllib.error.HTTPError, urllib.error.URLError):
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

The error message is too generic and doesn't provide useful debugging information. Consider logging the specific HTTP status code or error details to help users understand why the wheel download failed.

Suggested change
except (urllib.error.HTTPError, urllib.error.URLError):
except (urllib.error.HTTPError, urllib.error.URLError) as e:
print(f"Failed to download precompiled wheel from {wheel_url}.")
print(f"Error type: {type(e).__name__}")
if hasattr(e, 'code'):
print(f"HTTP status code: {getattr(e, 'code', 'N/A')}")
if hasattr(e, 'reason'):
print(f"Reason: {getattr(e, 'reason', 'N/A')}")

Copilot uses AI. Check for mistakes.
return super().run()

wheel_url, wheel_filename = get_wheel_url()
print("Guessing wheel URL: ", wheel_url)
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Using print statements for logging in production code is not ideal. Consider using the logging module for better control over log levels and output formatting.

Copilot uses AI. Check for mistakes.
archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}"

wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl")
print("Raw wheel path", wheel_path)
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

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

Using print statements for logging in production code is not ideal. Consider using the logging module for better control over log levels and output formatting.

Copilot uses AI. Check for mistakes.
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.

3 participants