Skip to content

Normalize wheel distribution names to match the PyPA spec#2954

Merged
messense merged 1 commit intoPyO3:mainfrom
asimov-systems:fix-wheel-names
Feb 4, 2026
Merged

Normalize wheel distribution names to match the PyPA spec#2954
messense merged 1 commit intoPyO3:mainfrom
asimov-systems:fix-wheel-names

Conversation

@artob
Copy link
Copy Markdown
Contributor

@artob artob commented Feb 2, 2026

This fixes building publishable sdists and wheels for packages where the name contains a dot (aka period, aka full stop). For example, asimov.py gets normalized into "asimov_py":

$ ls -1 target/wheels/
asimov_py-26.0.0.dev1-cp314-cp314-macosx_11_0_arm64.whl
asimov_py-26.0.0.dev1.tar.gz

Note some relevant history regarding distribution name normalization:

  1. The PEP 427 (2012) specification contained the regular expression [^\w\d.]+ which preserved dots.
  2. Popular tools (pip, setuptools, etc.) didn't actually follow this: instead, they replaced dots with underscores.
  3. The PyPA Binary Distribution Format specification was updated (in 2021) to match what tools actually did, explicitly requiring dots to be replaced with underscores.

This fixes building publishable sdists and wheels for packages where
the name contains a period. For example, "asimov.py" is normalized
into "asimov_py".
Copy link
Copy Markdown
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Copy Markdown
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

Updates distribution-name normalization to align with the current PyPA Binary Distribution Format spec so wheels/sdists are publishable when project names contain dots.

Changes:

  • Normalize distribution names by collapsing runs of -_. into _ and lowercasing for wheel/sdist filenames and .dist-info naming.
  • Update docstring to reflect the PyPA spec and how the normalized name is used.
  • Remove the WASI-only build guard that rejected names containing dots (now normalized away).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/metadata.rs Adjusts get_distribution_escaped() normalization behavior and updates its documentation accordingly.
src/build_context.rs Removes WASI dot-in-name rejection that is no longer relevant with the new normalization.

Comment thread src/metadata.rs
Comment thread src/metadata.rs
@messense messense merged commit c92a61d into PyO3:main Feb 4, 2026
83 of 90 checks passed
@artob artob deleted the fix-wheel-names branch February 9, 2026 22:20
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