Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of support for non-standard (PEP 440) wheel filenames #12938

Open
1 task done
notatallshaw opened this issue Aug 25, 2024 · 3 comments
Open
1 task done

Removal of support for non-standard (PEP 440) wheel filenames #12938

notatallshaw opened this issue Aug 25, 2024 · 3 comments
Labels
type: deprecation Related to deprecation / removal.
Milestone

Comments

@notatallshaw
Copy link
Member

notatallshaw commented Aug 25, 2024

What's the problem this feature will solve?

This issue it to track the the removal of supporting non-standard (PEP 440) wheel filenames.

Describe the solution you'd like

Pip will use packaging as the source of truth for the validity and parsing of wheel filenames

Alternative Solutions

None

Additional context

Previously pip implemented it's own custom logic but now will using the standard packaging library, you can check yourself by installing packaging and running:

>>> from packaging.utils import parse_wheel_filename
>>> parse_wheel_filename(my_wheel_filename)

Code of Conduct

@notatallshaw notatallshaw added type: feature request Request for a new feature S: needs triage Issues/PRs that need to be triaged labels Aug 25, 2024
@ichard26 ichard26 added type: deprecation Related to deprecation / removal. and removed type: feature request Request for a new feature S: needs triage Issues/PRs that need to be triaged labels Oct 12, 2024
@ichard26 ichard26 added this to the 25.1 milestone Oct 12, 2024
@testworksau
Copy link

testworksau commented Nov 12, 2024

Hello 👋🏼

I'm here as a result of spurious messages like the following in our builds:

pip 25.1 will enforce this behaviour change. A possible replacement is to rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata). Discussion can be found at https://github.com/pypa/pip/issues/12938
--
DEPRECATION: Wheel filename 'our_library_name-1.7.0_PullRequest0090.7-py3-none-any.whl' is not correctly normalised. Future versions of pip will raise the following error:
Invalid wheel filename (invalid version): our_library_name-1.7.0_PullRequest0090.7-py3-none-any
 
pip 25.1 will enforce this behaviour change. A possible replacement is to rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata). Discussion can be found at https://github.com/pypa/pip/issues/12938
DEPRECATION: Wheel filename 'our_library_name-1.8.0_PullRequest0091.1-py3-none-any.whl' is not correctly normalised. Future versions of pip will raise the following error:
Invalid wheel filename (invalid version): our_library_name-1.8.0_PullRequest0091.1-py3-none-any
 
pip 25.1 will enforce this behaviour change. A possible replacement is to rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata). Discussion can be found at https://github.com/pypa/pip/issues/12938
DEPRECATION: Wheel filename 'our_library_name-1.9.0_PullRequest0092.1-py3-none-any.whl' is not correctly normalised. Future versions of pip will raise the following error:
Invalid wheel filename (invalid version): our_library_name-1.9.0_PullRequest0092.1-py3-none-any
 
pip 25.1 will enforce this behaviour change. A possible replacement is to rename the wheel to use a correctly normalised name (this may require updating the version in the project metadata). Discussion can be found at https://github.com/pypa/pip/issues/12938
Collecting our_library_name>=1.56.0 (from our_other_library_name==0.0)

Given we have a history of incorrectly named wheels, if we were to fix the naming sometime between now and whenever pip 25.1 drops, what outcomes would we expect to see during package resolution?

What outcomes would we expect to see if a package has compliant versions, and someone accidentally publishes a non-compliant version if compliant versions meet the version requirement constraints?

@notatallshaw
Copy link
Member Author

Hi @testworksau and thanks for reporting.

Given we have a history of incorrectly named wheels, if we were to fix the naming sometime between now and whenever pip 25.1 drops, what outcomes would we expect to see during package resolution?

That's a great question, it should be that invalid file names give a warning, or an error, but the resolution moves on to valid names. It would be a great help if are you able to install pip from this PR and check what the current behavior is? You can install it like so:

pip install git+https://github.com/notatallshaw/pip.git@replace-custom-wheel-regex

What outcomes would we expect to see if a package has compliant versions, and someone accidentally publishes a non-compliant version if compliant versions meet the version requirement constraints?

The idea is that non-compliant versions should be ignored, but some feedback on a real world scenario would help a lot.

Looking at your actual wheel filename, currently the "version" part ends up including this "PullRequest" part and that's not a valid wheel filename:

>>> from pip._internal.models.wheel import Wheel
>>> my_wheel = Wheel('our_library_name-1.9.0_PullRequest0092.1-py3-none-any.whl')
>>> my_wheel.version
'1.9.0-PullRequest0092.1'

You can check the wheel filename spec: https://packaging.python.org/en/latest/specifications/binary-distribution-format/#file-format

You could add a build tag, but it is only allowed to be a number, so it would look like our_library_name-1.9.0-921-py3-none-any.whl.

@ichard26
Copy link
Member

Well, the specification only mandates that build tags start with a digit. So if you'd like, you could include 1pullrequest9999 as the build tag. Otherwise, if you don't need to publish anywhere (except for maybe a private index), you could look into local version segments, for example 1.9.0+pullrequest9999.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: deprecation Related to deprecation / removal.
Projects
None yet
Development

No branches or pull requests

3 participants