Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
S slapos.buildout
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • nexedi
  • slapos.buildout
  • Merge requests
  • !43

Open
Created Mar 13, 2025 by Xavier Thompson@xavier_thompsonOwner
  • Report abuse
Report abuse

WIP: Fix/pep 625 setuptools

  • Overview 3
  • Commits 36
  • Changes 20

Patch pkg_resources.safe_name in an attempt to fix the root cause of the inconsistency between setuptools' internal normalization and PEP 625's normalization.

PEP 625 states that sdist filenames must be normalized such that [.-] in project names are replaced by _ in the sdist filename, among other rules such as lowercasing every character.

Coincidentally, setuptools infers project names from the sdist filename, with the rule that characters not matching [A-Za-z0-9.] are replaced by -; in particular . maps to . and _ maps to - in the infered project name. This is done by pkg_resources.safe_name. After this the result is further lowercased to be used as a key for looking up distributions in a package index or already available in the filesystem environment.

In particular, PEP 625 maps [.-_] to the same character:

  • [.-_] --(PEP 625)--> _

Thus, the round trip maps [.-_] like this:

  • [.-_] --(PEP 625)--> _ --(safe_name)--> - --(.lower)--> -

While safe_name + .lower map . and [-_] to different characters:

  • . --(safe_name)--> . --(.lower)--> .
  • [-_] --(safe_name)--> - --(.lower)--> -

This means project names containing . are stored internally under a key that is different to the key which is used for lookup - leading to such projects not being found in the package index and appear missing when they are already installed.

Edited Mar 13, 2025 by Xavier Thompson
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: fix/pep-625-setuptools
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7