Skip to content

Add rstrip in def _strip_extras#13523

Merged
notatallshaw merged 3 commits into
pypa:mainfrom
mtsokol:fix-rstrip
Sep 11, 2025
Merged

Add rstrip in def _strip_extras#13523
notatallshaw merged 3 commits into
pypa:mainfrom
mtsokol:fix-rstrip

Conversation

@mtsokol

@mtsokol mtsokol commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Hi All,

Installing from .whl file with extras, where there's a whitespace between filename and extras section is broken:

bash-3.2$ pip install '/tmp/array_record/all_dist/array_record.whl [beam]'
ERROR: Invalid requirement: '/tmp/array_record/all_dist/array_record.whl [beam]': Expected package name at the start of dependency specifier
    /tmp/array_record/all_dist/array_record.whl [beam]
    ^
Hint: It looks like a path. File '/tmp/array_record/all_dist/array_record.whl [beam]' does not exist.

which is caused by untrimmed file extension: .whl instead of .whl.

This PR fixes it by striping path when separating from extras section, with a test that fails for the current main.

@notatallshaw

Copy link
Copy Markdown
Member

Hi @mtsokol thanks for your PR to pip, please be aware it may take a bit for a maintainer to review as we are all doing this on a volunteer basis.

@ichard26 ichard26 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will also permit -e "file:///path/to/project [extra]" but that doesn't carry over to a regular install. (Editable requirements are parsed using a different code path.) I think this is fine though as folks should be using the Direct URL syntax if they're looking to request an extra, anyway.

Comment thread news/13523.bugfix.rst Outdated
mtsokol and others added 2 commits August 15, 2025 10:32
Co-authored-by: Richard Si <sichard26@gmail.com>
@mtsokol

mtsokol commented Aug 15, 2025

Copy link
Copy Markdown
Contributor Author

@ichard26 Thanks! I included your suggestion.

@notatallshaw notatallshaw added this to the 25.3 milestone Aug 21, 2025

@notatallshaw notatallshaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mtsokol for your contribution to pip.

@notatallshaw notatallshaw merged commit 1e3c66e into pypa:main Sep 11, 2025
34 checks passed
@mtsokol mtsokol deleted the fix-rstrip branch September 11, 2025 07:44
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants