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

Make .egg-info filename parsing spec compliant #4533

Merged
merged 1 commit into from
Jun 25, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

It turns out that .egg-info files and directories can both have up to four segments in the filename: https://setuptools.pypa.io/en/latest/deprecated/python_eggs.html#filename-embedded-metadata. This PR upgrades the parsing and now uses the same parsing for files and directories.

Closes #4532.

@charliermarsh charliermarsh added bug Something isn't working compatibility Compatibility with a specification or another tool labels Jun 25, 2024
@charliermarsh
Copy link
Member Author

\cc @samypr100

@charliermarsh charliermarsh force-pushed the charlie/egg branch 3 times, most recently from 2dd3ae7 to 7dacaaa Compare June 25, 2024 23:33
@charliermarsh charliermarsh enabled auto-merge (squash) June 25, 2024 23:38
@charliermarsh charliermarsh enabled auto-merge (squash) June 25, 2024 23:41
@charliermarsh charliermarsh merged commit ca92b55 into main Jun 25, 2024
47 checks passed
@charliermarsh charliermarsh deleted the charlie/egg branch June 25, 2024 23:49
severen added a commit to severen/uv that referenced this pull request Aug 18, 2024
PR astral-sh#4533 introduced (almost) spec compliant parsing of .egg-info
filenames, but added the overly strict requirement that the distribution
version must be present. This causes various `uv pip` operations to fail
in environments where there are .egg-info files without a version
component, so loosen this check by making the version component
optional.
severen added a commit to severen/uv that referenced this pull request Aug 18, 2024
PR astral-sh#4533 introduced (almost) spec compliant parsing of .egg-info
filenames, but added the overly strict requirement that the distribution
version must be present. This causes various `uv pip` operations to fail
in environments where there are .egg-info files without a version
component, so loosen this check by making the version component
optional.
severen added a commit to severen/uv that referenced this pull request Aug 18, 2024
PR astral-sh#4533 introduced (almost) spec compliant parsing of .egg-info
filenames, but added the overly strict requirement that the distribution
version must be present. This causes various `uv pip` operations to fail
in environments where there are .egg-info files without a version
component, so loosen this check by making the version component optional
and reading the version from the egg metadata when it is not present.
charliermarsh pushed a commit that referenced this pull request Aug 18, 2024
## Summary

PR #4533 introduced (almost) spec compliant parsing of `.egg-info`
filenames, but added the overly strict requirement that the distribution
version must be present. This causes various `uv pip` operations to fail
in environments where there are `.egg-info` files without a version
component, so loosen this check by making the version component optional
and reading the version from the egg metadata when it is not present.

As an example of the issue, running `uv pip list` on my system currently
results in
```
error: Failed to read metadata from: `/usr/lib/python3.12/site-packages/PySide6.egg-info`
  Caused by: The `.egg-info` filename "PySide6.egg-info" is missing a version
```
whereas regular `pip list` succeeds:
```
$ pip list | rg -S pyside
PySide6                   6.7.2
```

## Test Plan

This has been tested by altering the `.egg-info` filename tests as
needed and ensuring the full test suite passes locally.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv pip install fails to read metadata when running on Docker container due to failure to parse egg version
2 participants