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

Restore support for pkginfo 1.11 #1123

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

jaraco
Copy link
Member

@jaraco jaraco commented Jun 25, 2024

For now, this approach retains the current behavior that an unrecognized metadata version will fail with an error.

This approach splits out the detection based on the version of pkginfo. Starting with pkginfo 1.11, it now properly detects when a metadata version is unrecognized and errors on that condition explicitly. For backward compatibility, until pkginfo 1.11 is the minimum, the check will still provide guidance to consider the metadata version when fields are missing.

Closes #1116

@jaraco jaraco force-pushed the bugfix/1116-pkginfo-warnings branch 5 times, most recently from 53f0216 to 71346e0 Compare June 25, 2024 18:11
@jaraco jaraco marked this pull request as ready for review June 25, 2024 18:13
@jaraco
Copy link
Member Author

jaraco commented Jun 25, 2024

Well, shoot. It seems that after allowing pkginfo 1.11, the type checks are failing. It seems that pkginfo.Distribution.name was str and now is str | None. Same for .version.

twine/package.py Outdated Show resolved Hide resolved
twine/repository.py Outdated Show resolved Hide resolved
@woodruffw
Copy link
Member

Random thought: is there a reason this can't constrain pkginfo ~= 1.11 in pyproject.toml? That would avoid the need for the run-time version check + some of the extra handling in this PR.

@jaraco
Copy link
Member Author

jaraco commented Jun 26, 2024

Random thought: is there a reason this can't constrain pkginfo ~= 1.11 in pyproject.toml? That would avoid the need for the run-time version check + some of the extra handling in this PR.

My thought was that there are probably users still reliant on older versions, so it would be nice to have at least one release transition where users aren't forced to the newer version. I absolutely agree that after twine stabilizes, we might bump the dependency on pkginfo (and remove the compatibility logic). I coded it in such a way as to make it easy to remove the compatibility logic.

I also observed that there's already an open issue #1070 tracking the move to pkginfo 1.10, so that issue would need to be addressed first (or simultaneously) with the move to 1.11.

@jaraco jaraco force-pushed the bugfix/1116-pkginfo-warnings branch 2 times, most recently from 1ca93e2 to a0fdb54 Compare June 26, 2024 14:29
@jaraco jaraco force-pushed the bugfix/1116-pkginfo-warnings branch from a0fdb54 to a0da730 Compare June 26, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[self tests] test_pkginfo_returns_no_metadata fails against pkginfo 1.11.0
2 participants