Skip to content

Comments

Make .egg-info filename parsing spec compliant#4533

Merged
charliermarsh merged 1 commit intomainfrom
charlie/egg
Jun 25, 2024
Merged

Make .egg-info filename parsing spec compliant#4533
charliermarsh merged 1 commit intomainfrom
charlie/egg

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 disabled auto-merge June 25, 2024 23:39
@charliermarsh charliermarsh enabled auto-merge (squash) June 25, 2024 23:41
@charliermarsh charliermarsh merged commit ca92b55 into main Jun 25, 2024
@charliermarsh charliermarsh deleted the charlie/egg branch June 25, 2024 23:49
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