Skip to content

Conversation

Copy link

Copilot AI commented Sep 23, 2025

Problem

Package names with dots (e.g., jaraco.functools) were not being normalized correctly according to PEP 503, causing searches to fail when users tried both naming conventions. For example:

# This would work
avail_wheels jaraco_functools

# But this would not find the same packages
avail_wheels jaraco.functools

The issue was that the package name canonicalization in wild_requirements.py only replaced hyphens with underscores, but didn't handle dots, which should also be normalized to underscores per PEP 503.

Solution

Updated the package name normalization logic to replace both dots and hyphens with underscores:

# Before
self.name = req.name.replace("-", "_").lower()

# After  
self.name = req.name.replace("-", "_").replace(".", "_").lower()

This ensures that all of these package name variations normalize to the same canonical form:

  • jaraco.functoolsjaraco_functools
  • jaraco-functoolsjaraco_functools
  • jaraco_functoolsjaraco_functools

Testing

  • Added comprehensive test test_package_name_normalization_dots_and_underscores() to verify the fix
  • Updated existing tests to reflect the correct normalization behavior
  • Verified that both naming conventions now work identically through manual testing

Impact

This change improves user experience by allowing both common package naming conventions to work correctly, while maintaining full backward compatibility. The fix follows Python packaging standards (PEP 503) and ensures consistent behavior across the tool.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ccoulombe <22602168+ccoulombe@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix this issue. jaraco_functools or jaraco.functools should both work and be valid names that returns results Fix package name normalization to handle dots in addition to hyphens Sep 23, 2025
Copilot AI requested a review from ccoulombe September 23, 2025 15:45
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.

2 participants