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

Use Metadata10 to parse PKG-INFO of legacy editable #3450

Merged
merged 1 commit into from May 8, 2024

Conversation

hauntsaninja
Copy link
Contributor

It turns out setuptools often uses Metadata-Version 2.1 in their PKG-INFO: https://github.com/hauntsaninja/setuptools/blob/4e766834d72623f3b938f1d4148547ea73af1bf5/setuptools/dist.py#L64
Metadata23 requires Metadata-Version of at least 2.2.

This means that uv doesn't actually recognise legacy editable installations from the most common way you'd actually get legacy editable installations (works great for most legacy editables I make at work though!)

Anyway, over here we only need the version and don't care about anything else. Rather than make a Metadata21, I just add a version field to Metadata10. The one slightly tricky thing is that only Metadata-Version 1.2 and greater guarantee that the version number is PEP 440 compatible, so I store the version in Metadata10 as a String and only parse to Version at time of use.

Also did you know that back in 2004, paramiko had a pokemon based versioning system?

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Also did you know that back in 2004, paramiko had a pokemon based versioning system?

Bring it back

@konstin konstin merged commit 5a07923 into astral-sh:main May 8, 2024
43 checks passed

----- stderr -----
error: Failed to read metadata: from [SITE_PACKAGES]/paramiko.egg-link
Caused by: after parsing '0.1b0', found 'ulbasaur', which is not part of a valid version
Copy link
Member

Choose a reason for hiding this comment

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

Error message fixed in #3453

@hauntsaninja hauntsaninja deleted the uv-metadata10 branch May 8, 2024 09:40
@charliermarsh charliermarsh added the bug Something isn't working label May 8, 2024
@charliermarsh
Copy link
Member

Thanks! LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants